From 4daafca0b75d50b9864407e90030b896e8164064 Mon Sep 17 00:00:00 2001 From: Matt Thorson Date: Sat, 30 May 2020 13:20:16 -0700 Subject: [PATCH] StateMachine error check --- src/Components/Logic/StateMachine.bf | 2 ++ 1 file changed, 2 insertions(+) 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.");