From bc986fa887c8e603680ff16fa3e4869b79ef6667 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 11 Dec 2023 13:57:07 +0100 Subject: [PATCH] Gracefully deal with empty ossync files in UrlSynchronization --- modules/sync/syncs/urlsynchronization.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/sync/syncs/urlsynchronization.cpp b/modules/sync/syncs/urlsynchronization.cpp index ca0fda73f5..df3b67acd4 100644 --- a/modules/sync/syncs/urlsynchronization.cpp +++ b/modules/sync/syncs/urlsynchronization.cpp @@ -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",