diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2018-10-10 10:01:02 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-10 06:27:21 -0700 |
commit | 8034af5ad5726846ea0d227d8fa3d13aebde7e36 (patch) | |
tree | 67a495cb6febd699478dba092fba1b5d15cd9db5 /core/downloadfromdcthread.cpp | |
parent | 8686b53c3735b0937e585ca42afc1279558e5162 (diff) | |
download | subsurface-8034af5ad5726846ea0d227d8fa3d13aebde7e36.tar.gz |
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 <jlmulder@xs4all.nl>
Diffstat (limited to 'core/downloadfromdcthread.cpp')
-rw-r--r-- | core/downloadfromdcthread.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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, ""))) |