Improve panic report with reentrant SlotMap use (#22667)
`double_lease_panic` already does what we want, just extend it to the indexing operation as well. Release Notes: - N/A
This commit is contained in:
@@ -117,8 +117,9 @@ impl EntityMap {
|
|||||||
|
|
||||||
pub fn read<T: 'static>(&self, model: &Model<T>) -> &T {
|
pub fn read<T: 'static>(&self, model: &Model<T>) -> &T {
|
||||||
self.assert_valid_context(model);
|
self.assert_valid_context(model);
|
||||||
self.entities[model.entity_id]
|
self.entities
|
||||||
.downcast_ref()
|
.get(model.entity_id)
|
||||||
|
.and_then(|entity| entity.downcast_ref())
|
||||||
.unwrap_or_else(|| double_lease_panic::<T>("read"))
|
.unwrap_or_else(|| double_lease_panic::<T>("read"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user