Fix potential crash when trying to read room info too early
This commit is contained in:
parent
6e8adc7320
commit
dbea031a86
@ -1587,6 +1587,8 @@ RoomInfo
|
|||||||
Cache::singleRoomInfo(const std::string &room_id)
|
Cache::singleRoomInfo(const std::string &room_id)
|
||||||
{
|
{
|
||||||
auto txn = ro_txn(env_);
|
auto txn = ro_txn(env_);
|
||||||
|
|
||||||
|
try {
|
||||||
auto statesdb = getStatesDb(txn, room_id);
|
auto statesdb = getStatesDb(txn, room_id);
|
||||||
|
|
||||||
std::string_view data;
|
std::string_view data;
|
||||||
@ -1607,6 +1609,10 @@ Cache::singleRoomInfo(const std::string &room_id)
|
|||||||
e.what());
|
e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (const lmdb::error &e) {
|
||||||
|
nhlog::db()->warn(
|
||||||
|
"failed to read room info from db: room_id ({}), {}", room_id, e.what());
|
||||||
|
}
|
||||||
|
|
||||||
return RoomInfo();
|
return RoomInfo();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user