From 36adbd91188ef72591ed7012383e6e6d766be248 Mon Sep 17 00:00:00 2001 From: Elena Torro Date: Thu, 20 Nov 2025 10:59:44 +0100 Subject: [PATCH] :bug: Fix insert shape on empty frame --- render-wasm/src/shapes.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/render-wasm/src/shapes.rs b/render-wasm/src/shapes.rs index 0c90cb016e..5e986e78a5 100644 --- a/render-wasm/src/shapes.rs +++ b/render-wasm/src/shapes.rs @@ -1305,8 +1305,12 @@ impl Shape { for st in structure { match st.entry_type { StructureEntryType::AddChild => { - let index = usize::min(result.len() - 1, st.index as usize); - result.shift_insert(index, st.id); + if result.is_empty() { + result.insert(st.id); + } else { + let index = usize::min(result.len() - 1, st.index as usize); + result.shift_insert(index, st.id); + } } StructureEntryType::RemoveChild => { to_remove.insert(&st.id);