mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-01-02 01:03:32 +01:00
Fix IndexOutOfRangeException
Fix `IndexOutOfRangeException` if an exception does not have an associated stack trace. Resolves #1798.
This commit is contained in:
committed by
Patrik Svensson
parent
b5c839030c
commit
6105ee2a86
@@ -65,7 +65,7 @@ internal static class ExceptionFormatter
|
||||
|
||||
var stackTrace = new StackTrace(ex, fNeedFileInfo: true);
|
||||
var allFrames = stackTrace.GetFrames();
|
||||
if (allFrames[0]?.GetMethod() == null)
|
||||
if (allFrames.Length > 0 && allFrames[0]?.GetMethod() == null)
|
||||
{
|
||||
// if we can't easily get the method for the frame, then we are in AOT
|
||||
// fallback to using ToString method of each frame.
|
||||
|
||||
Reference in New Issue
Block a user