浏览代码

Add ToArray to prevent 'Collection has been modified' Exception in older runtimes (#1976)

Thomas Nind 3 年之前
父节点
当前提交
bfe9878554
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Terminal.Gui/Core/View.cs

+ 1 - 1
Terminal.Gui/Core/View.cs

@@ -1820,7 +1820,7 @@ namespace Terminal.Gui {
 		/// <param name="command"></param>
 		public void ClearKeybinding (params Command [] command)
 		{
-			foreach (var kvp in KeyBindings.Where (kvp => kvp.Value.SequenceEqual (command))) {
+			foreach (var kvp in KeyBindings.Where (kvp => kvp.Value.SequenceEqual (command)).ToArray()) {
 				KeyBindings.Remove (kvp.Key);
 			}
 		}