Use try_global()

This commit is contained in:
Joseph T. Lyons 2024-01-18 00:58:50 -05:00
parent 933fb87013
commit b807e6fe80
10 changed files with 52 additions and 70 deletions

View file

@ -586,13 +586,9 @@ impl<T: Item> ItemHandle for View<T> {
}
fn to_followable_item_handle(&self, cx: &AppContext) -> Option<Box<dyn FollowableItemHandle>> {
if cx.has_global::<FollowableItemBuilders>() {
let builders = cx.global::<FollowableItemBuilders>();
let item = self.to_any();
Some(builders.get(&item.entity_type())?.1(&item))
} else {
None
}
let builders = cx.try_global::<FollowableItemBuilders>()?;
let item = self.to_any();
Some(builders.get(&item.entity_type())?.1(&item))
}
fn on_release(