Skip to content

Commit

Permalink
Avoid an exception in Exception.GetCaptureState() if the stack trace …
Browse files Browse the repository at this point in the history
…is empty, it can happen on wasm+aot. (dotnet#46539)
  • Loading branch information
vargaz committed Jan 5, 2021
1 parent 6e111ea commit 4c13a9d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ internal DispatchState CaptureDispatchState()
if (_traceIPs != null)
{
stackFrames = Diagnostics.StackTrace.get_trace(this, 0, true);
stackFrames[stackFrames.Length - 1].isLastFrameFromForeignException = true;
if (stackFrames.Length > 0)
stackFrames[stackFrames.Length - 1].isLastFrameFromForeignException = true;

if (foreignExceptionsFrames != null)
{
Expand Down

0 comments on commit 4c13a9d

Please sign in to comment.