diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-04 18:34:30 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-05 04:09:02 +0300 |
commit | 420aab94543f171eabb9065a6aae5408aad0fbdc (patch) | |
tree | 9e4838f28c3f077b7e14290ac7b40e6928a1afba /core/downloadfromdcthread.cpp | |
parent | 8a1839610458ea788304f700886d54af680d6e53 (diff) | |
download | subsurface-420aab94543f171eabb9065a6aae5408aad0fbdc.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/downloadfromdcthread.cpp')
-rw-r--r-- | core/downloadfromdcthread.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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); |