mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-24 04:02:50 +08:00
(#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:
parent
3a7b8aa1d2
commit
9d985f0f0a
@ -221,9 +221,9 @@ internal static class ExceptionFormatter
|
|||||||
return true;
|
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;
|
var numberOfFrames = allFrames.Length;
|
||||||
|
|
||||||
for (var i = 0; i < numberOfFrames; i++)
|
for (var i = 0; i < numberOfFrames; i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user