Explorar o código

fix nullref on unclean shutdown (#1725)

Wouter Tinus %!s(int64=3) %!d(string=hai) anos
pai
achega
a5e355c5e2
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  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;