mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Better panic message when we reference a property that does not exist
This commit is contained in:
parent
29e0ae913c
commit
c58ffe1589
1 changed files with 6 additions and 3 deletions
|
@ -1252,11 +1252,14 @@ pub(crate) fn get_property_ptr(nr: &NamedReference, instance: InstanceRef) -> *c
|
|||
.items
|
||||
.get(element.id.as_str())
|
||||
.unwrap_or_else(|| panic!("Unknown element for {}.{}", element.id, nr.name()));
|
||||
let prop_info = item_info
|
||||
.rtti
|
||||
.properties
|
||||
.get(nr.name())
|
||||
.unwrap_or_else(|| panic!("Property {} not in {}", nr.name(), element.id));
|
||||
core::mem::drop(element);
|
||||
let item = unsafe { item_info.item_from_component(enclosing_component.as_ptr()) };
|
||||
unsafe {
|
||||
item.as_ptr().add(item_info.rtti.properties.get(nr.name()).unwrap().offset()).cast()
|
||||
}
|
||||
unsafe { item.as_ptr().add(prop_info.offset()).cast() }
|
||||
}
|
||||
eval::ComponentInstance::GlobalComponent(glob) => glob.as_ref().get_property_ptr(nr.name()),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue