downloader: check for parsing failure

Don't continue if the dive log could not be loaded. Otherwise we end up
writing out an empty dive log.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
This commit is contained in:
Richard Fuchs 2024-01-27 09:14:12 -05:00 committed by Dirk Hohndel
parent 0ee5c8f03a
commit 1952d1c187

View file

@ -91,7 +91,10 @@ int main(int argc, char **argv)
filesOnCommandLine = !files.isEmpty() || !importedFiles.isEmpty();
if (!files.isEmpty()) {
qDebug() << "loading dive data from" << files;
parse_file(qPrintable(files.first()), &divelog);
if (parse_file(qPrintable(files.first()), &divelog) < 0) {
printf("Failed to load dives from file '%s', aborting.\n", qPrintable(files.first()));
exit(1);
}
}
print_files();
if (!quit) {