浏览代码

Allow RemoveTab to work on tabsets with no panels (#546)

James 2 年之前
父节点
当前提交
bb25b88179
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      Source/Core/Elements/ElementTabSet.cpp

+ 6 - 3
Source/Core/Elements/ElementTabSet.cpp

@@ -78,11 +78,14 @@ void ElementTabSet::RemoveTab(int tab_index)
 		return;
 
 	Element* panels = GetChildByTag("panels");
-	Element* tabs = GetChildByTag("tabs");
-
-	if (panels->GetNumChildren() > tab_index && tabs->GetNumChildren() > tab_index)
+	if (panels->GetNumChildren() > tab_index)
 	{
 		panels->RemoveChild(panels->GetChild(tab_index));
+	}
+
+	Element* tabs = GetChildByTag("tabs");
+	if (tabs->GetNumChildren() > tab_index)
+	{
 		tabs->RemoveChild(tabs->GetChild(tab_index));
 	}
 }