Skip to content

Commit

Permalink
fix panic in panic
Browse files Browse the repository at this point in the history
don't set the panic hook if we are already panicking
  • Loading branch information
WorldSEnder committed Dec 28, 2024
1 parent 58e0d62 commit 0c953e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/yew/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ pub fn set_custom_panic_hook(hook: Box<dyn Fn(&PanicInfo<'_>) + Sync + Send + 's
}

fn set_default_panic_hook() {
if std::thread::panicking() {
// very unlikely, but avoid hitting this when running parallel tests.
return;
}
if !PANIC_HOOK_IS_SET.with(|hook_is_set| hook_is_set.replace(true)) {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
}
Expand Down

0 comments on commit 0c953e4

Please sign in to comment.