Fixed crash when trying to set variable id that cannot be found

This commit is contained in:
n00b87
2026-02-12 14:00:36 -06:00
parent e4d92c74b1
commit 72ecdc046e
2 changed files with 19 additions and 11 deletions

View File

@@ -6196,14 +6196,22 @@ bool check_rule()
} }
else else
{ {
switch(var_type) if(var_id_index >= 0 && var_id_index < id.size())
{ {
case ID_TYPE_NUM: switch(var_type)
vm_asm.push_back("mov !" + rc_intToString(id[var_id_index].vec_pos) + " " + expr_result); {
break; case ID_TYPE_NUM:
case ID_TYPE_STR: vm_asm.push_back("mov !" + rc_intToString(id[var_id_index].vec_pos) + " " + expr_result);
vm_asm.push_back("mov$ !" + rc_intToString(id[var_id_index].vec_pos) + " " + expr_result); break;
break; case ID_TYPE_STR:
vm_asm.push_back("mov$ !" + rc_intToString(id[var_id_index].vec_pos) + " " + expr_result);
break;
}
}
else
{
rc_setError("Identifier \"" + var_id + "\" could not be resolved");
return false;
} }
} }

View File

@@ -1,5 +1,5 @@
# depslib dependency file v1.0 # depslib dependency file v1.0
1769580634 source:/home/n00b/Projects/RCBASIC4/rcbasic_build/main.cpp 1770701118 source:/home/n00b/Projects/RCBASIC4/rcbasic_build/main.cpp
<iostream> <iostream>
<stack> <stack>
<vector> <vector>
@@ -37,7 +37,7 @@
1752004854 /home/n00b/Projects/RCBASIC4/rcbasic_build/constants.h 1752004854 /home/n00b/Projects/RCBASIC4/rcbasic_build/constants.h
<vector> <vector>
1758412944 /home/n00b/Projects/RCBASIC4/rcbasic_build/parser.h 1770926352 /home/n00b/Projects/RCBASIC4/rcbasic_build/parser.h
"tokenizer.h" "tokenizer.h"
"identifier.h" "identifier.h"
"rc_global.h" "rc_global.h"