Gracefully deal with empty ossync files in UrlSynchronization

This commit is contained in:
Alexander Bock
2023-12-11 13:57:07 +01:00
parent bc71bd6186
commit bc986fa887

View File

@@ -210,7 +210,7 @@ bool UrlSynchronization::isEachFileValid() {
file.close();
createSyncFile();
// File is valid until some date
return true;
return true;
}
// Otherwise first line is the version number.
std::string ossyncVersion = line;
@@ -244,6 +244,10 @@ bool UrlSynchronization::isEachFileValid() {
// i.e. no sync needed.
return fileValidAsJ2000 > todaysDateAsJ2000;
}
else if (ossyncVersion.empty()) {
// For some reason we ended up with an empty synchronization file
return false;
}
else {
LERROR(fmt::format(
"{}: Unknown ossync version number read. Got {} while {} and below are valid",