From d50ba4954aacf398bf259a4e41b9323d565edc0a Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 23 Dec 2017 15:27:32 +0200 Subject: [PATCH] Fixed potential crash when calling undefined function in ZScript The following code which uses explicit class specifier led to a crash: class C { void F() { Object.Undefined(); } } --- src/scripting/backend/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 564240203..d504282d1 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8091,7 +8091,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx) { bool error; PFunction *afd = FindClassMemberFunction(ccls, ctx.Class, MethodName, ScriptPosition, &error); - if ((afd->Variants[0].Flags & VARF_Method) && (afd->Variants[0].Flags & VARF_Virtual)) + if ((nullptr != afd) && (afd->Variants[0].Flags & VARF_Method) && (afd->Variants[0].Flags & VARF_Virtual)) { staticonly = false; novirtual = true;