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;
}
}