Return nullopt for state events in rooms we are not in

This commit is contained in:
Nicolas Werner 2021-11-21 20:10:19 +01:00
parent a6e633cdab
commit 70592911a1
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 33 additions and 33 deletions

View File

@ -451,6 +451,7 @@ private:
const std::string &room_id,
std::string_view state_key = "")
{
try {
constexpr auto type = mtx::events::state_content_to_type<T>;
static_assert(type != mtx::events::EventType::Unsupported,
"Not a supported type in state events.");
@ -484,7 +485,6 @@ private:
}
}
try {
return json::parse(value).get<mtx::events::StateEvent<T>>();
} catch (std::exception &e) {
return std::nullopt;