Fixed a bug where calling an invalid virtual function would cause a crash.

This commit is contained in:
CandiceJoy 2023-01-26 07:39:58 -06:00 committed by Rachael Alexanderson
parent 10b6d21ba2
commit 70d355cfa3

View file

@ -849,6 +849,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
return 0; return 0;
} }
auto p = o->GetClass(); auto p = o->GetClass();
if(p->Virtuals.Size() <= 0) ThrowAbortException(X_OTHER,"Attempted to call an invalid virtual function in class %s",p->TypeName.GetChars());
assert(C < p->Virtuals.Size()); assert(C < p->Virtuals.Size());
reg.a[a] = p->Virtuals[C]; reg.a[a] = p->Virtuals[C];
} }