Browse Source

fix nullref on unclean shutdown (#1725)

Wouter Tinus 3 years ago
parent
commit
a5e355c5e2
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

+ 5 - 2
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -1892,8 +1892,11 @@ namespace Terminal.Gui {
 		void IMainLoopDriver.MainIteration ()
 		{
 			while (resultQueue.Count > 0) {
-				var inputEvent = resultQueue.Dequeue () [0];
-				ProcessInput?.Invoke (inputEvent);
+				var inputRecords = resultQueue.Dequeue ();
+				if (inputRecords != null && inputRecords.Length > 0) {
+					var inputEvent = inputRecords [0];
+					ProcessInput?.Invoke (inputEvent);
+				}
 			}
 			if (winChanged) {
 				winChanged = false;