From 92ba4b9cc7bbc2e1818191745d1976f9b915be9a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 3 Nov 2017 17:44:09 +0100 Subject: Replace QMap::operator[] with QMap::value() QMap::operator[] creates a new default constructed entry in the map if no entry with the given key exists. While not problematic (since typically nullptrs are inserted) this is usually not what you want for read access. Signed-off-by: Berthold Stoeger --- desktop-widgets/configuredivecomputerdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop-widgets/configuredivecomputerdialog.cpp') diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp index 0a601730f..296528fb0 100644 --- a/desktop-widgets/configuredivecomputerdialog.cpp +++ b/desktop-widgets/configuredivecomputerdialog.cpp @@ -908,7 +908,7 @@ void ConfigureDiveComputerDialog::getDeviceData() device_data.vendor = strdup(selected_vendor.toUtf8().data()); device_data.product = strdup(selected_product.toUtf8().data()); - device_data.descriptor = descriptorLookup[selected_vendor + selected_product]; + device_data.descriptor = descriptorLookup.value(selected_vendor + selected_product); device_data.deviceid = device_data.diveid = 0; auto dc = SettingsObjectWrapper::instance()->dive_computer_settings; -- cgit v1.2.3-70-g09d2