Check SuperPmi map for null
authorCarol Eidt <carol.eidt@microsoft.com>
Fri, 25 May 2018 17:30:46 +0000 (10:30 -0700)
committerCarol Eidt <carol.eidt@microsoft.com>
Fri, 25 May 2018 19:07:57 +0000 (12:07 -0700)
On Linux, calling an instance method with a null `this` pointer causes a seg fault.
This fixes the case of querying the `CanInlineTypeCheckWithObjectVTable` map in SuperPmi when no query has been recorded by `recCanInlineTypeCheckWithObjectVTable`. There appear to be other cases of this, but this is the one that I'm running into currently.

Commit migrated from https://github.com/dotnet/coreclr/commit/f05efe953681375384577dcc77e488c4800715f1

src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp

index 61a654e..1fa824e 100644 (file)
@@ -4327,6 +4327,7 @@ void MethodContext::dmpCanInlineTypeCheckWithObjectVTable(DWORDLONG key, DWORD v
 }
 BOOL MethodContext::repCanInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE cls)
 {
+    AssertCodeMsg(CanInlineTypeCheckWithObjectVTable != nullptr, EXCEPTIONCODE_MC, "No map for CanInlineTypeCheckWithObjectVTable");
     return (BOOL)CanInlineTypeCheckWithObjectVTable->Get((DWORDLONG)cls);
 }