Skip to content

Commit

Permalink
outline a panic
Browse files Browse the repository at this point in the history
  • Loading branch information
JoJoJet committed Jul 29, 2022
1 parent 673e7f4 commit d1a58be
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/bevy_app/src/sub_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,15 @@ impl SubSchedules {
/// # Panics
/// If the schedule is currently [extracted](#method.extract_scope).
pub fn get_mut<S: Stage>(&mut self, label: impl ScheduleLabel) -> Option<&mut S> {
#[cold]
fn panic(label: impl Debug) -> ! {
panic!("cannot get sub-schedule '{label:?}', as it is currently extracted")
}

let label = label.as_label();
let sched = match self.map.get_mut(&label)?.0.as_deref_mut() {
Some(x) => x,
None => {
panic!("cannot get sub-schedule '{label:?}', as it is currently extracted");
}
None => panic(label),
};
sched.downcast_mut()
}
Expand Down

0 comments on commit d1a58be

Please sign in to comment.