From 7d90a3912b1bdfd38c5c06f87f2547ecb4756174 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 27 Aug 2024 13:48:53 -0700 Subject: [PATCH] fix nullref in layoutNode.findNode --- frontend/layout/lib/layoutNode.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/layout/lib/layoutNode.ts b/frontend/layout/lib/layoutNode.ts index 95bc3b7a..ed65c25a 100644 --- a/frontend/layout/lib/layoutNode.ts +++ b/frontend/layout/lib/layoutNode.ts @@ -111,6 +111,7 @@ export function removeChild(parent: LayoutNode, childToRemove: LayoutNode, start * @returns The node with the given id or undefined if no node with the given id was found. */ export function findNode(node: LayoutNode, id: string): LayoutNode | undefined { + if (!node) return; if (node.id === id) return node; if (!node.children) return; for (const child of node.children) {