diff options
Diffstat (limited to 'ecs/src/entity.rs')
-rw-r--r-- | ecs/src/entity.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ecs/src/entity.rs b/ecs/src/entity.rs index ef91d20..6c9ec32 100644 --- a/ecs/src/entity.rs +++ b/ecs/src/entity.rs @@ -48,12 +48,14 @@ impl<'a> Handle<'a> let component = self.get_matching_components(ComponentT::id()).next()?; Some( - ComponentHandle::from_entity_component_ref(component).unwrap_or_else(|err| { - panic!( - "Taking component {} lock failed: {err}", - type_name::<ComponentT>() - ); - }), + ComponentHandle::from_entity_component_ref(&component).unwrap_or_else( + |err| { + panic!( + "Creating handle to component {} failed: {err}", + type_name::<ComponentT>() + ); + }, + ), ) } @@ -74,10 +76,10 @@ impl<'a> Handle<'a> let component = self.get_matching_components(ComponentT::id()).next()?; Some( - ComponentHandleMut::from_entity_component_ref(component).unwrap_or_else( + ComponentHandleMut::from_entity_component_ref(&component).unwrap_or_else( |err| { panic!( - "Taking component {} lock failed: {err}", + "Creating handle to component {} failed: {err}", type_name::<ComponentT>() ); }, |