From a74d7ba498271dca9690d85995f019aab56ab617 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 18 Jan 2022 16:11:23 -0800 Subject: [PATCH] Handle `debuggerResult` being null in `ProcessDebuggerResult` Not entirely sure why this can be the case, but a stacktrace from a null dereference crash indicates it can be null. Since the existing logic is only doing something if the `ResumeAction` field is not null, I assume we similarly do nothing if the entire object is also null (since that implies the former, too). --- .../Services/PowerShell/Debugging/PowerShellDebugContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs b/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs index 8e6241acb..74e088d47 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs @@ -151,7 +151,7 @@ public void SetDebuggerResumed() public void ProcessDebuggerResult(DebuggerCommandResults debuggerResult) { - if (debuggerResult.ResumeAction is not null) + if (debuggerResult?.ResumeAction is not null) { SetDebugResuming(debuggerResult.ResumeAction.Value); RaiseDebuggerResumingEvent(new DebuggerResumingEventArgs(debuggerResult.ResumeAction.Value));