Skip to content

Commit 8de86ac

Browse files
committed
Add some safety to PopulateCollectionBoxChildrenList
1 parent a23dce7 commit 8de86ac

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Editor/GUIEditorApp.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,13 @@ namespace RTEGUI {
269269
void GUIEditorApp::PopulateCollectionBoxChildrenList(GUICollectionBox *collectionBox) const {
270270
m_ControlsInActiveCollectionBoxList->ClearList();
271271

272+
std::vector<GUIControl *> controls = *collectionBox->GetChildren();
273+
if (controls.empty()) {
274+
return;
275+
}
276+
272277
// Go through all the top-level (directly under root) controls and add only the CollectionBoxes to the list here
273-
for (GUIControl *control : *collectionBox->GetChildren()) {
278+
for (GUIControl *control : controls) {
274279
m_ControlsInActiveCollectionBoxList->AddItem(control->GetName());
275280
// Check if this is selected in the editor, and if so, select it in the list too
276281
if (collectionBox == m_SelectionInfo.Control) { m_ControlsInActiveCollectionBoxList->SetSelectedIndex(m_CollectionBoxList->GetItemList()->size() - 1); }

0 commit comments

Comments
 (0)