default to Undefined if room avatar URL was not found despite checking if its Some

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-02-11 12:16:51 -05:00 committed by June
parent bb1edc3f1a
commit 0ea8657070

View file

@ -1640,7 +1640,9 @@ pub async fn sync_events_v4_route(
ruma::JsOption::Some(heroes_avatar)
} else {
match services().rooms.state_accessor.get_avatar(room_id)? {
ruma::JsOption::Some(avatar) => ruma::JsOption::Some(avatar.url.unwrap()),
ruma::JsOption::Some(avatar) => avatar
.url
.map_or(ruma::JsOption::Undefined, ruma::JsOption::Some),
ruma::JsOption::Null => ruma::JsOption::Null,
ruma::JsOption::Undefined => ruma::JsOption::Undefined,
}