Skip to content

Commit

Permalink
Fix NullReferenceException in OnBreak (#1179)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lzybkr authored and daxian-dbw committed Nov 14, 2019
1 parent a4d5409 commit 9644382
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PSReadLine/PlatformWindows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static bool OnBreak(ConsoleBreakSignal signal)
if (signal == ConsoleBreakSignal.Close || signal == ConsoleBreakSignal.Shutdown)
{
// Set the event so ReadKey throws an exception to unwind.
_singleton._closingWaitHandle.Set();
_singleton?._closingWaitHandle?.Set();
}

return false;
Expand Down

0 comments on commit 9644382

Please # to comment.