On 15 December, 2016 - Jan Mulder wrote:
> diff --git a/desktop-widgets/configuredivecomputerdialog.cpp
> b/desktop-widgets/configuredivecomputerdialog.cpp
> index 79cdcaf..b54a913 100644
> --- a/desktop-widgets/configuredivecomputerdialog.cpp
> +++ b/desktop-widgets/configuredivecomputerdialog.cpp
> @@ -263,8 +264,14 @@ void OstcFirmwareCheck::checkLatest(QWidget *_parent,
> device_data_t *data)
> int firmwareOnDevice = devData.libdc_firmware;
> QString firmwareOnDeviceString = QString("%1.%2").arg(firmwareOnDevice
> / 256).arg(firmwareOnDevice % 256);
>
> - // Convert the latestFirmwareAvailable to a integear we can compare with
> + // Convert the latestFirmwareAvailable to a integer we can compare with
> QStringList fwParts = latestFirmwareAvailable.split(".");
> +
> + // Be a little carefull here. For example, when the HW website is down
> or changed, do not
> + // just continue processing but silently ignore the update check.
> Better than just segfaulting
> + // on invalid index
> + if (fwParts.length() != 2)
> + return;
One could make it even more defensive, and verify that the two fwParts
parse to nice int's, within valid ranges.
> int latestFirmwareAvailableNumber = fwParts[0].toInt() * 256 +
> fwParts[1].toInt();
> if (latestFirmwareAvailableNumber > firmwareOnDevice) {
> QMessageBox response(parent);
Anyway, LGTM
//Anton
--
Anton Lundin +46702-161604
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface