From 8034af5ad5726846ea0d227d8fa3d13aebde7e36 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Wed, 10 Oct 2018 10:01:02 +0200 Subject: QML UI: do not try to download from DC with empty vendor/product Disable the Download button when one of the fields vendor, product, connection is not filled in. The app will crash when trying. In addition, make the underlying core code to actual download more safe by checking this, and silently fail instead of crash. And, yes, this is a double fix in this scenario, but the core code is used in more places, so better safe than sorry. Signed-off-by: Jan Mulder --- core/downloadfromdcthread.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core') diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index a9c8ce70b..8e937346d 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -71,6 +71,10 @@ void DownloadThread::run() internalData->descriptor = descriptorLookup[m_data->vendor() + m_data->product()]; internalData->download_table = &downloadTable; internalData->btname = strdup(m_data->devBluetoothName().toUtf8()); + if (!internalData->descriptor) { + qDebug() << "No download possible when DC type is unknown"; + return; + } #if defined(Q_OS_ANDROID) // on Android we either use BT, a USB device, or we download via FTDI cable if (!internalData->bluetooth_mode && (same_string(internalData->devname, "FTDI") || same_string(internalData->devname, ""))) -- cgit v1.2.3-70-g09d2