From d850a67ce8254d593e71237a68d8b1c970017e34 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Wed, 27 May 2015 21:19:09 +0200 Subject: [PATCH] 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 Signed-off-by: Dirk Hohndel --- configuredivecomputerthreads.cpp | 14 ++++++-------- 1 file 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); } }