From 420aab94543f171eabb9065a6aae5408aad0fbdc Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 4 Oct 2018 18:34:30 +0200 Subject: Cleanup: don't produce no-dives error message in libdivecomputer.c If no dives were downloaded in do_libdivecomputer_import(), an error message would be produced. To check for downloaded dives, the function would access the global downloadTable instead of the actual table the dives are imported to (at the moment the same - but the interface allows for a different table). Move the error-creation to the caller to avoid this situation. An alternative option would be to check the actual table the dives were supposed to be downloaded to. But from a program-logic point of view "no dives" does not seem like an error condition. Signed-off-by: Berthold Stoeger --- core/downloadfromdcthread.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/downloadfromdcthread.cpp') diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index b6b5d9191..70e4aac7d 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -91,6 +91,8 @@ void DownloadThread::run() error = str_error(errorText, internalData->devname, internalData->vendor, internalData->product); qDebug() << "Finishing download thread:" << error; } else { + if (!downloadTable.nr) + error = tr("No new dives downloaded from dive computer"); qDebug() << "Finishing download thread:" << downloadTable.nr << "dives downloaded"; } qPrefDiveComputer::set_vendor(internalData->vendor); -- cgit v1.2.3-70-g09d2