Skip to content

Commit 9644382

Browse files
lzybkrdaxian-dbw
authored andcommitted
Fix NullReferenceException in OnBreak (#1179)
The Windows event log reports a NullReferenceException in PlatformWindows.OnBreak. It's unclear what the repro is (perhaps closing the console before it is fully initialized) but a fix is simple - adding null checks.
1 parent a4d5409 commit 9644382

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PSReadLine/PlatformWindows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private static bool OnBreak(ConsoleBreakSignal signal)
8888
if (signal == ConsoleBreakSignal.Close || signal == ConsoleBreakSignal.Shutdown)
8989
{
9090
// Set the event so ReadKey throws an exception to unwind.
91-
_singleton._closingWaitHandle.Set();
91+
_singleton?._closingWaitHandle?.Set();
9292
}
9393

9494
return false;

0 commit comments

Comments
 (0)