瀏覽代碼

Empty collection check

Jamie D 5 年之前
父節點
當前提交
34b7639fe4
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      Terminal.Gui/Core/View.cs

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

@@ -695,7 +695,9 @@ namespace Terminal.Gui {
 
 			while (subviews.Count > 0) {
 				Remove (subviews [0]);
-				Remove (tabIndexes [0]);
+				if (tabIndexes.Count > 0) {
+					Remove (tabIndexes [0]);
+				}
 			}
 		}
 
@@ -1186,7 +1188,8 @@ namespace Terminal.Gui {
 		{
 			var clipRect = new Rect (Point.Empty, frame.Size);
 
-			Driver.SetAttribute (HasFocus ? ColorScheme.Focus : ColorScheme.Normal);
+			if (ColorScheme != null)
+				Driver.SetAttribute (HasFocus ? ColorScheme.Focus : ColorScheme.Normal);
 
 			if (!ustring.IsNullOrEmpty (Text)) {
 				Clear ();