Downloader: fix segfault

With no files given and no config present, the downloader segfaults due
to empty `files`. Print a message instead.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
This commit is contained in:
Richard Fuchs 2024-01-23 09:59:59 -05:00 committed by Dirk Hohndel
parent 05ef933ff7
commit e00e1bb9f7

View file

@ -102,7 +102,14 @@ int main(int argc, char **argv)
cliDownloader(prefs.dive_computer.vendor, prefs.dive_computer.product, prefs.dive_computer.device);
}
}
save_dives(qPrintable(files.first()));
if (!files.isEmpty()) {
qDebug() << "saving dive data to" << files;
save_dives(qPrintable(files.first()));
}
else {
printf("No log files given, not saving dive data.\n");
printf("Give a log file name as argument, or configure a cloud URL.\n");
}
clear_divelog(&divelog);
taglist_free(g_tag_list);
parse_xml_exit();