Skip to content

Commit b6571a5

Browse files
committed
Avoid null-dereference of _languageServer in OnDebuggerStop handler
This primarily occured during unit testing, where the language server is not instantiated. Note that elsewhere in this file it is treated similarly.
1 parent da43937 commit b6571a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,7 @@ private void OnDebuggerStop(object sender, DebuggerStopEventArgs e)
24162416

24172417
if (!IsDebugServerActive)
24182418
{
2419-
_languageServer.SendNotification("powerShell/startDebugger");
2419+
_languageServer?.SendNotification("powerShell/startDebugger");
24202420
}
24212421

24222422
// We've hit a breakpoint so go to a new line so that the prompt can be rendered.

0 commit comments

Comments
 (0)