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:
parent
8151dc7696
commit
de08e47e5b
1 changed files with 3 additions and 2 deletions
|
@ -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"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue