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>
This commit is contained in:
Anton Lundin 2015-05-27 21:19:09 +02:00 committed by Dirk Hohndel
parent a8c013869b
commit d850a67ce8

View file

@ -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);
}
}