From fe75cd82d6f4f4ecca9c7cd97d9cdfbae646dcff Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 28 Oct 2026 10:46:31 +0100 Subject: web: fix panic when loading an alternative hill database The load result was matched on while the scrutinee's borrow_mut() was still alive; the Ok arm called pan.borrow() again, which panics (and traps the whole wasm module, hanging the app). End the borrow before the match. --- crates/wipfel/src/app.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/wipfel/src') diff --git a/crates/wipfel/src/app.rs b/crates/wipfel/src/app.rs index 4194789..71cd168 100644 --- a/crates/wipfel/src/app.rs +++ b/crates/wipfel/src/app.rs @@ -550,7 +550,11 @@ pub fn app() -> Html { }, _ => bytes, }; - match pan.borrow_mut().load_data_from_bytes(&raw) { + // NOTE: the borrow must end before the match arm, + // which calls pan.borrow() itself (nested borrow + // would panic and trap the whole wasm module) + let res = pan.borrow_mut().load_data_from_bytes(&raw); + match res { Ok(()) => { markers.set(Vec::new()); track.set(Vec::new()); -- cgit v1.2.3