diff options
author | Anton Lundin <glance@acc.umu.se> | 2015-05-27 21:19:09 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-05-27 15:37:16 -0700 |
commit | d850a67ce8254d593e71237a68d8b1c970017e34 (patch) | |
tree | 0ca4b9972495a16f66d00d79d9ee86a2f310cf44 | |
parent | a8c013869b0fd47c577dbaad95970db63fe604ad (diff) | |
download | subsurface-d850a67ce8254d593e71237a68d8b1c970017e34.tar.gz |
Restructure ReadSettingsThread::run
This moves the dc_device_close call inside the if case for
dc_device_open, to get rid of the special error case and to look and
behave the same as the other ::run calls.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | configuredivecomputerthreads.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp index 418a7930e..50cdc6838 100644 --- a/configuredivecomputerthreads.cpp +++ b/configuredivecomputerthreads.cpp @@ -1508,17 +1508,15 @@ void ReadSettingsThread::run() supported = false; break; } + dc_device_close(m_data->device); + + if (!supported) { + lastError = tr("This feature is not yet available for the selected dive computer."); + emit error(lastError); + } } else { lastError = tr("Could not a establish connection to the dive computer."); emit error(lastError); - // So we don't trigger the "unsupported" clause later.. - supported = true; - } - dc_device_close(m_data->device); - - if (!supported) { - lastError = tr("This feature is not yet available for the selected dive computer."); - emit error(lastError); } } |