More defensively handle initial expand

Reviewed By: jknoxville

Differential Revision: D32674423

fbshipit-source-id: 0d8216ebb9da9530c53c7209dcd18eb677c73fc3
This commit is contained in:
Pascal Hartig
2021-11-26 03:52:02 -08:00
committed by Facebook GitHub Bot
parent 9773e79724
commit 41dd757616

View File

@@ -281,7 +281,7 @@ export default class Inspector extends Component<Props, State> {
// When opening the inspector for the first time, expand all elements that
// contain only 1 child recursively.
async performInitialExpand(element: Element | undefined): Promise<void> {
if (!element || !element.children.length) {
if (!element || !element.children || !element.children.length) {
// element has no children so we're as deep as we can be
return;
}