Skip to content

Commit

Permalink
[MERGE #3835 @boingoing] Fix null dereference in LoadAllConstants whe…
Browse files Browse the repository at this point in the history
…n code has no 'this' binding

Merge pull request #3835 from boingoing:FixEventHandlerThisBinding

Fixes https://microsoft.visualstudio.com/DefaultCollection/OS/_workitems?id=13977382&_a=edit
  • Loading branch information
boingoing committed Sep 28, 2017
2 parents f40d571 + 72c87a0 commit 965098b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Runtime/ByteCode/ByteCodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,10 @@ void ByteCodeGenerator::LoadAllConstants(FuncInfo *funcInfo)
byteCodeFunction->MapAndSetEnvRegister(funcInfo->GetEnvRegister());
if (funcInfo->GetIsTopLevelEventHandler())
{
byteCodeFunction->MapAndSetThisRegisterForEventHandler(funcInfo->GetThisSymbol()->GetLocation());
if (funcInfo->GetThisSymbol())
{
byteCodeFunction->MapAndSetThisRegisterForEventHandler(funcInfo->GetThisSymbol()->GetLocation());
}
// The environment is the namespace hierarchy starting with "this".
Assert(!funcInfo->RegIsConst(funcInfo->GetEnvRegister()));
thisLoadedFromParams = true;
Expand Down

0 comments on commit 965098b

Please sign in to comment.