diff --git a/src/Components/Logic/StateMachine.bf b/src/Components/Logic/StateMachine.bf index 133732c..6ed6e00 100644 --- a/src/Components/Logic/StateMachine.bf +++ b/src/Components/Logic/StateMachine.bf @@ -56,6 +56,8 @@ namespace Strawberry private Result Set(TIndex to) { + if (!states.ContainsKey(to)) + Runtime.FatalError("State does not exist in this State Machine. Call Add() first!"); if (inStateCall) Runtime.FatalError("Cannot set State directly from inside a State Enter/Exit/Update call. Return the desired State change instead.");