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],