Skip to content

Commit 679eeac

Browse files
committed
chore(sdk): Remove an unwrap in debug_string.
1 parent e0778ec commit 679eeac

File tree

1 file changed

+8
-1
lines changed
  • crates/matrix-sdk/src/event_cache/room

1 file changed

+8
-1
lines changed

crates/matrix-sdk/src/event_cache/room/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,14 @@ impl RoomEventCache {
418418
/// Return a nice debug string (a vector of lines) for the linked chunk of
419419
/// events for this room.
420420
pub async fn debug_string(&self) -> Vec<String> {
421-
self.inner.state.read().await.unwrap().room_linked_chunk().debug_string()
421+
match self.inner.state.read().await {
422+
Ok(read_guard) => read_guard.room_linked_chunk().debug_string(),
423+
Err(err) => {
424+
warn!(?err, "Failed to obtain the read guard for the `RoomEventCache`");
425+
426+
vec![]
427+
}
428+
}
422429
}
423430
}
424431

0 commit comments

Comments
 (0)