Prepare for GetMethod to return null and avoid crashing (#107)

Closes #106
This commit is contained in:
Mitch Capper (he, him) 2020-08-16 15:30:11 -07:00 committed by GitHub
parent cda8e4e625
commit 0f17b3029b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,7 @@ namespace System.Diagnostics
var method = frame.GetMethod();
// Always show last stackFrame
if (!ShowInStackTrace(method) && i < stackFrames.Length - 1)
if (method != null && !ShowInStackTrace(method) && i < stackFrames.Length - 1)
{
continue;
}
@ -62,7 +62,7 @@ namespace System.Diagnostics
var row = frame.GetFileLineNumber();
var column = frame.GetFileColumnNumber();
var ilOffset = frame.GetILOffset();
if (string.IsNullOrEmpty(fileName) && ilOffset >= 0)
if (method != null && string.IsNullOrEmpty(fileName) && ilOffset >= 0)
{
// .NET Framework and older versions of mono don't support portable PDBs
// so we read it manually to get file name and line information