fix nullref in layoutNode.findNode

This commit is contained in:
Evan Simkowitz 2024-08-27 13:48:53 -07:00
parent 755f8f2385
commit 7d90a3912b
No known key found for this signature in database

View File

@ -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) {