Skip to content

Commit

Permalink
Fix panic messages for uninitialized windows
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbat00 committed Mar 26, 2023
1 parent e58d928 commit ea64f7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl<'w, 's> EguiContexts<'w, 's> {
.q
.iter_mut()
.find(|(window_entity, _ctx, _primary_window)| *window_entity == window)
.expect("`EguiContexts::ctx_for_window_mut` was called for an uninitialized context (window {window}), make sure your system is run after [`EguiSet::InitContexts`] (or [`EguiStartupSet::InitContexts`] for startup systems)");
.unwrap_or_else(|| panic!("`EguiContexts::ctx_for_window_mut` was called for an uninitialized context (window {window:?}), make sure your system is run after [`EguiSet::InitContexts`] (or [`EguiStartupSet::InitContexts`] for startup systems)"));
ctx.into_inner().get_mut()
}

Expand Down Expand Up @@ -367,7 +367,7 @@ impl<'w, 's> EguiContexts<'w, 's> {
.q
.iter()
.find(|(window_entity, _ctx, _primary_window)| *window_entity == window)
.expect("`EguiContexts::ctx_for_window` was called for an uninitialized context (window {window}), make sure your system is run after [`EguiSet::InitContexts`] (or [`EguiStartupSet::InitContexts`] for startup systems)");
.unwrap_or_else(|| panic!("`EguiContexts::ctx_for_window` was called for an uninitialized context (window {window:?}), make sure your system is run after [`EguiSet::InitContexts`] (or [`EguiStartupSet::InitContexts`] for startup systems)"));
ctx.get()
}

Expand Down

0 comments on commit ea64f7c

Please sign in to comment.