fix: possible crash

This commit is contained in:
AlexeyZavar 2024-03-13 16:34:39 +03:00
parent 2414e51a9b
commit 0e26b39faf

View file

@ -153,13 +153,19 @@ void moveCurrentDatabase() {
}
void initialize() {
const auto res = storage.sync_schema_simulate(true);
auto movePrevious = false;
for (const auto val : res | std::views::values) {
if (val == sync_schema_result::dropped_and_recreated) {
movePrevious = true;
break;
try {
const auto res = storage.sync_schema_simulate(true);
for (const auto val : res | std::views::values) {
if (val == sync_schema_result::dropped_and_recreated) {
movePrevious = true;
break;
}
}
} catch (...) {
LOG(("Exception during sync simulation; possibly corrupted database"));
movePrevious = true;
}
if (movePrevious) {