Skip to content

Commit

Permalink
fix: possible crash
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyZavar committed Mar 13, 2024
1 parent 2414e51 commit 0e26b39
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Telegram/SourceFiles/ayu/data/ayu_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0e26b39

Please sign in to comment.