Fix crash if APIInspector::RevealParameter is called for hidden object

* There's nothing to expand for hidden objects so make sure we don't crash or
  expand the wrong item.
This commit is contained in:
baldurk
2025-08-15 12:56:26 +01:00
parent bd193696b8
commit fb2c09a4d9
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -2125,6 +2125,7 @@ void addStructuredChildren(RDTreeWidgetItem *parent, const SDObject &parentObj)
name = obj->name;
RDTreeWidgetItem *item = new RDTreeWidgetItem({name, QString()});
item->setTag(QVariant::fromValue((void *)obj));
item->setText(1, SDObject2Variant(obj, false));
+5
View File
@@ -93,6 +93,11 @@ void APIInspector::RevealParameter(SDObject *param)
if(current->GetChild(i) == next)
{
current = next;
// revealing a parameter that wasn't added, bail out now
if(i >= parent->childCount() || parent->child((int)i)->tag().value<void *>() != next)
return;
item = parent->child((int)i);
break;
}