From ee06457b2f5e029a735d22c7ca62dd6444427499 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 5 Jul 2021 08:28:16 -0700 Subject: [PATCH] Fixed invalid 'this' lookup during const type resolution --- IDEHelper/Compiler/BfModule.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 9ecbcd2c..87d76dbe 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -13991,8 +13991,11 @@ BfTypedValue BfModule::GetThis() return BfTypedValue(GetDefaultValue(thisType), thisType, BfTypedValueKind_ThisValue); } } - - auto localDef = useMethodState->mLocals[0]; + + if (mCurMethodInstance == NULL) + return BfTypedValue(); + + auto localDef = useMethodState->mLocals[0]; auto curMethodOwner = mCurMethodInstance->mMethodInstanceGroup->mOwner; if ((curMethodOwner->IsStruct()) || (curMethodOwner->IsTypedPrimitive())) {