From 0cb6c0b3d2a3fb5c216611861c412298eb3f702d Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Wed, 18 Aug 2021 03:18:37 -0700 Subject: [PATCH] Fix NPE on children expansion Summary: See task for stack trace. Reviewed By: timur-valiev Differential Revision: D30393458 fbshipit-source-id: 71589b42fd579db95dfb04a96a00966f8bc65a2a --- desktop/plugins/public/layout/Inspector.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/plugins/public/layout/Inspector.tsx b/desktop/plugins/public/layout/Inspector.tsx index 5ae390858..696c37788 100644 --- a/desktop/plugins/public/layout/Inspector.tsx +++ b/desktop/plugins/public/layout/Inspector.tsx @@ -277,8 +277,8 @@ export default class Inspector extends Component { // When opening the inspector for the first time, expand all elements that // contain only 1 child recursively. - async performInitialExpand(element: Element): Promise { - if (!element.children.length) { + async performInitialExpand(element: Element | undefined): Promise { + if (!element || !element.children.length) { // element has no children so we're as deep as we can be return; }