1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed crash when defer scope target doesn't exist

This commit is contained in:
Simon Lübeß 2025-03-01 22:37:33 +01:00
parent cfd2bab9fb
commit c8f96a7a22

View file

@ -7283,7 +7283,16 @@ void BfModule::Visit(BfDeferStatement* deferStmt)
scope = &mCurMethodState->mHeadScope;
}
else if (deferStmt->mScopeName != NULL)
{
scope = FindScope(deferStmt->mScopeName, true);
if (scope == NULL)
{
AssertErrorState();
// The scope doesn't exist, continue with the current scope so we still get an evaluation of the deferred code
scope = mCurMethodState->mCurScope;
}
}
else
scope = mCurMethodState->mCurScope;