Browse Source

Add extra try/catch cancellation ex

tznind 9 months ago
parent
commit
2b7d0c7f70
1 changed files with 10 additions and 2 deletions
  1. 10 2
      Terminal.Gui/ConsoleDrivers/NetDriver.cs

+ 10 - 2
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -179,10 +179,18 @@ internal class NetEvents : IDisposable
         {
         {
             _winChange.Set ();
             _winChange.Set ();
 
 
-            if (_inputQueue.TryTake (out var item,-1,_netEventsDisposed.Token))
+            try
             {
             {
-                return item;
+                if (_inputQueue.TryTake (out var item, -1, _netEventsDisposed.Token))
+                {
+                    return item;
+                }
             }
             }
+            catch (OperationCanceledException)
+            {
+                return null;
+            }
+
         }
         }
 
 
         return null;
         return null;