diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-11-03 17:44:09 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-04 14:26:21 +0100 |
commit | 92ba4b9cc7bbc2e1818191745d1976f9b915be9a (patch) | |
tree | 91fa732736dae61c3118ae6e600f51e72c5dc3df /desktop-widgets/downloadfromdivecomputer.cpp | |
parent | e3580eda6f41a34f3662ad8ae9284adb48a38142 (diff) | |
download | subsurface-92ba4b9cc7bbc2e1818191745d1976f9b915be9a.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 3b551edef..59accbcd2 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -482,7 +482,7 @@ void DownloadFromDCWidget::updateDeviceEnabled() { // Set up the DC descriptor dc_descriptor_t *descriptor = NULL; - descriptor = descriptorLookup[ui.vendor->currentText() + ui.product->currentText()]; + descriptor = descriptorLookup.value(ui.vendor->currentText() + ui.product->currentText()); // call dc_descriptor_get_transport to see if the dc_transport_t is DC_TRANSPORT_SERIAL if (dc_descriptor_get_transport(descriptor) == DC_TRANSPORT_SERIAL) { |