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 <[email protected]>
---
 configuredivecomputerthreads.cpp | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index 418a793..50cdc68 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);
        }
 }
 
-- 
2.1.4

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to