From 0ea86570706c25bdbdd38a0d31d19122d856ca43 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 11 Feb 2024 12:16:51 -0500 Subject: [PATCH] default to Undefined if room avatar URL was not found despite checking if its Some Signed-off-by: strawberry --- src/api/client_server/sync.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index bf8e7f37..05847c3f 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -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, }