From 5e5b56b6847cd57bef820620590293f6c734d497 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Wed, 21 Jun 2023 07:29:49 -0700 Subject: [PATCH] Handle case where IOS can send active child -1 Summary: Sometimes iOS can return active child -1, which is causing some crashes on desktop, (see the tasks) this is a client bug but the desktop shouldnt crash none the less seems to occur only sometimes only on fboios Reviewed By: lblasa Differential Revision: D46894387 fbshipit-source-id: f9c34fe8fb32691486455224f82bed9c3dce6cef --- .../public/ui-debugger/components/Visualization2D.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/desktop/plugins/public/ui-debugger/components/Visualization2D.tsx b/desktop/plugins/public/ui-debugger/components/Visualization2D.tsx index dfb13db5ed9..3bdf6ecc47d 100644 --- a/desktop/plugins/public/ui-debugger/components/Visualization2D.tsx +++ b/desktop/plugins/public/ui-debugger/components/Visualization2D.tsx @@ -194,7 +194,11 @@ function Visualization2DNode({ //if there is an active child don't draw the other children //this means we don't draw overlapping activities / tabs etc - if (node.activeChildIdx && node.activeChildIdx < node.children.length) { + if ( + node.activeChildIdx != null && + node.activeChildIdx >= 0 && + node.activeChildIdx < node.children.length + ) { nestedChildren = [node.children[node.activeChildIdx]]; } else { nestedChildren = node.children;