From 5f8b16ebe97ab70cd22b9f75d9cdeca0bfd8d014 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Thu, 10 Feb 2022 00:17:13 +0200 Subject: [PATCH] Use new WizData::assignLabel() to ignore label assignments in unexecuted branches --- src/components/ScriptEditor/ScriptEditor.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/ScriptEditor/ScriptEditor.tsx b/src/components/ScriptEditor/ScriptEditor.tsx index 1c9b99d..fa802d1 100644 --- a/src/components/ScriptEditor/ScriptEditor.tsx +++ b/src/components/ScriptEditor/ScriptEditor.tsx @@ -87,9 +87,7 @@ const ScriptEditor: React.FC = ({ scriptWiz }) => { // Assign the label to the last element on the stack if (labelMatches) { - if (!scriptWiz.stackDataList.main.length) throw new Error('nothing to label'); - const lastStack = scriptWiz.stackDataList.main[scriptWiz.stackDataList.main.length-1]; - lastStack.label = labelMatches[0]; + scriptWiz.assignLabel(labelMatches[0]); } }, [scriptWiz],