From d17bb6318e17f85a243c6f618f9ed22b81ce4751 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Mon, 3 Jul 2017 23:43:37 +0200 Subject: Don't try to dereference empty product/vendor list Signed-off-by: Robert C. Helling --- core/downloadfromdcthread.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index acb5ce6a8..ad4f0e4d0 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -378,6 +378,8 @@ QString DCDeviceData::getDeviceDescriptorVendor(const QString ¤tVendorText // unsure being a dive computer if (currentVendorText == QObject::tr("Paired Bluetooth Devices")) { int i = productList[currentVendorText].indexOf(currentProductText); + if (i < 0 || btAllDevices.length() <= i) + return QString(); QString dcVendor = dc_descriptor_get_vendor(btAllDevices[i].dcDescriptor); qDebug() << "getDeviceDescriptorVendor" << dcVendor; return dcVendor; @@ -406,6 +408,8 @@ QString DCDeviceData::getDeviceDescriptorProduct(const QString ¤tVendorTex // unsure being a dive computer if (currentVendorText == QObject::tr("Paired Bluetooth Devices")) { int i = productList[currentVendorText].indexOf(currentProductText); + if (i >= btAllDevices.length() || i < 0) + return QString(); QString dcProduct = dc_descriptor_get_product(btAllDevices[i].dcDescriptor); qDebug() << "getDeviceDescriptorProduct" << dcProduct; return dcProduct; -- cgit v1.2.3-70-g09d2