Fix NPE on children expansion

Summary: See task for stack trace.

Reviewed By: timur-valiev

Differential Revision: D30393458

fbshipit-source-id: 71589b42fd579db95dfb04a96a00966f8bc65a2a
This commit is contained in:
Pascal Hartig
2021-08-18 03:18:37 -07:00
committed by Facebook GitHub Bot
parent 352e7e3a01
commit 0cb6c0b3d2

View File

@@ -277,8 +277,8 @@ 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): Promise<void> {
if (!element.children.length) {
async performInitialExpand(element: Element | undefined): Promise<void> {
if (!element || !element.children.length) {
// element has no children so we're as deep as we can be
return;
}