diff --git a/bindings/matrix-sdk-ffi/src/room.rs b/bindings/matrix-sdk-ffi/src/room.rs index 95c8d5bca..9a7327093 100644 --- a/bindings/matrix-sdk-ffi/src/room.rs +++ b/bindings/matrix-sdk-ffi/src/room.rs @@ -157,18 +157,15 @@ impl Room { }); } - pub fn fetch_members(&self) { - let timeline = match &*RUNTIME.block_on(self.timeline.read()) { - Some(t) => Arc::clone(t), - None => { - error!("Timeline not set up, can't fetch members"); - return; - } - }; + pub fn fetch_members(&self) -> Result, ClientError> { + let timeline = RUNTIME + .block_on(self.timeline.read()) + .clone() + .context("Timeline not set up, can't fetch members")?; - RUNTIME.spawn(async move { + Ok(Arc::new(TaskHandle::new(RUNTIME.spawn(async move { timeline.fetch_members().await; - }); + })))) } pub fn display_name(&self) -> Result {