(#922) fixed ArgumentNullException on .NET Framework

It seems, when Spectre.Console is compiled for
netstandard2.0, StackTrace.GetFrames() returns null
instead of an empty array.
This commit is contained in:
Nils Andresen 2022-08-17 14:24:53 +02:00 committed by Patrik Svensson
parent 3a7b8aa1d2
commit 9d985f0f0a

View File

@ -221,9 +221,9 @@ internal static class ExceptionFormatter
return true;
}
private static IEnumerable<StackFrame> FilterStackFrames(this IEnumerable<StackFrame?> frames)
private static IEnumerable<StackFrame> FilterStackFrames(this IEnumerable<StackFrame?>? frames)
{
var allFrames = frames.ToArray();
var allFrames = frames?.ToArray() ?? Array.Empty<StackFrame>();
var numberOfFrames = allFrames.Length;
for (var i = 0; i < numberOfFrames; i++)