Fix a few db access crashes

This commit is contained in:
Nicolas Werner 2021-03-12 17:13:56 +01:00
parent 2a70847c80
commit 6ad4065de4
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 14 additions and 5 deletions

View file

@ -873,11 +873,14 @@ ChatPage::trySync()
http::client()->sync(
opts,
[this, since = cache::nextBatchToken()](const mtx::responses::Sync &res,
mtx::http::RequestErr err) {
if (since != cache::nextBatchToken()) {
nhlog::net()->warn("Duplicate sync, dropping");
return;
[this, since = opts.since](const mtx::responses::Sync &res, mtx::http::RequestErr err) {
try {
if (since != cache::nextBatchToken()) {
nhlog::net()->warn("Duplicate sync, dropping");
return;
}
} catch (const lmdb::error &e) {
nhlog::db()->warn("Logged out in the mean time, dropping sync");
}
if (err) {