cleanup. return errors instead of panics

the panics were originally added to aid with testing during some rework.
i'm 99% certain these two scenarios cannot occur anymore anyway
This commit is contained in:
Gered 2022-05-16 19:00:48 -04:00
parent ee9474b231
commit 4d7f84281b

View file

@ -331,10 +331,12 @@ impl<ContextType> States<ContextType> {
// now figure out what state change processing is needed based on the current state ... // now figure out what state change processing is needed based on the current state ...
match self.state_of_front_state() { match self.state_of_front_state() {
Some(State::Paused) => { Some(State::Paused) => {
panic!("oops - paused"); // should never happen now. leaving here just in case ...
return Err(StateError::GameStateInvalidState(State::Paused));
}, },
Some(State::Dead) => { Some(State::Dead) => {
panic!("oops - dead"); // should never happen now. leaving here just in case ...
return Err(StateError::GameStateInvalidState(State::Dead));
}, },
Some(State::TransitionIn) => { Some(State::TransitionIn) => {
let state = self.states.front_mut().unwrap(); let state = self.states.front_mut().unwrap();