fix: don't panic when Model is dropped before parts are generated

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2025-10-31 20:57:36 +01:00
parent a3afb08664
commit 771a79cd33

View File

@@ -646,7 +646,7 @@ impl ModelAspect for Model {
}
impl Drop for Model {
fn drop(&mut self) {
for p in self.parts.get().unwrap().iter() {
for p in self.parts.get().iter().flat_map(|v|v.iter()) {
if let Some(node) = p.spatial.node() {
node.destroy();
}