From 6ec7d9af59cf3ab72ec032a0445fc54631a1c3be Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Sat, 18 Feb 2017 08:02:38 +0200 Subject: [PATCH] No more crashing in anonymous functions during runtime check of virtualscope --- src/scripting/backend/codegen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index f0011de81..fe8243d28 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -107,7 +107,8 @@ void FScopeBarrier_ValidateNew(PClass* cls, PFunction* callingfunc) // this can be imported in vmexec.h void FScopeBarrier_ValidateCall(PFunction* calledfunc, PFunction* callingfunc, PClass* selftype) { - int outerside = FScopeBarrier::SideFromFlags(callingfunc->Variants[0].Flags); + // [ZZ] anonymous blocks have 0 variants, so give them Side_Virtual. + int outerside = callingfunc->Variants.Size() ? FScopeBarrier::SideFromFlags(callingfunc->Variants[0].Flags) : FScopeBarrier::Side_Virtual; if (outerside == FScopeBarrier::Side_Virtual) outerside = FScopeBarrier::SideFromObjectFlags(callingfunc->OwningClass->ObjectFlags); int innerside = FScopeBarrier::SideFromFlags(calledfunc->Variants[0].Flags);