Don't error out if weak handle isn't present

This commit is contained in:
hodasemi 2024-04-18 08:02:12 +02:00
parent e20c42925b
commit a50ef55ad4

View file

@ -356,12 +356,16 @@ impl States {
let logging = self.log_state_change; let logging = self.log_state_change;
Ok(Box::new(move || { Ok(Box::new(move || {
Self::_set_state( if let Some(current) = weak_current_state.upgrade() {
weak_state.as_ref().map(|w| w.upgrade()).flatten(), Self::_set_state(
&mut *weak_current_state.upgrade().unwrap().lock().unwrap(), weak_state.as_ref().map(|w| w.upgrade()).flatten(),
gui_handler.as_ref().map(|h| h.upgrade()).flatten(), &mut *current.lock().unwrap(),
logging, gui_handler.as_ref().map(|h| h.upgrade()).flatten(),
) logging,
)?;
}
Ok(())
})) }))
} }
} }