浏览代码

Fix null reference exception when OnLeave event handlers clear focus.

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

+ 3 - 2
Terminal.Gui/Core/View.cs

@@ -1321,8 +1321,9 @@ namespace Terminal.Gui {
 
 			// Remove focus down the chain of subviews if focus is removed
 			if (!value && focused != null) {
-				focused.OnLeave (view);
-				focused.SetHasFocus (false, view);
+				var f = focused;
+				f.OnLeave (view);
+				f.SetHasFocus (false, view);
 				focused = null;
 			}
 		}