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

@@ -6195,15 +6195,23 @@ bool check_rule()
}
}
else
{
switch(var_type)
{
case ID_TYPE_NUM:
vm_asm.push_back("mov !" + rc_intToString(id[var_id_index].vec_pos) + " " + expr_result);
break;
case ID_TYPE_STR:
vm_asm.push_back("mov$ !" + rc_intToString(id[var_id_index].vec_pos) + " " + expr_result);
break;
{
if(var_id_index >= 0 && var_id_index < id.size())
{
switch(var_type)
{
case ID_TYPE_NUM:
vm_asm.push_back("mov !" + rc_intToString(id[var_id_index].vec_pos) + " " + expr_result);
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
1769580634 source:/home/n00b/Projects/RCBASIC4/rcbasic_build/main.cpp
1770701118 source:/home/n00b/Projects/RCBASIC4/rcbasic_build/main.cpp
<iostream>
<stack>
<vector>
@@ -37,7 +37,7 @@
1752004854 /home/n00b/Projects/RCBASIC4/rcbasic_build/constants.h
<vector>
1758412944 /home/n00b/Projects/RCBASIC4/rcbasic_build/parser.h
1770926352 /home/n00b/Projects/RCBASIC4/rcbasic_build/parser.h
"tokenizer.h"
"identifier.h"
"rc_global.h"