Browse Source

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

James 2 years ago
parent
commit
bb25b88179
1 changed files with 6 additions and 3 deletions
  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));
 	}
 }