From 8f6c7109d8e6245234a63f9d0e94eecef2dbd962 Mon Sep 17 00:00:00 2001 From: Michael Trosper Date: Thu, 20 Aug 2026 08:10:02 -0600 Subject: [PATCH] Fix TypeError crash in GraphLaTeX renderer when nodes/links are missing problemData.nodes.map() threw "Cannot read properties of undefined (reading 'map')" whenever a frame arrived without a nodes or links array, crashing DFA/NFA Acceptance visualizations. Normalize both to [] before use, matching the same guard already in StandardGraphSvgReact.js (the D3 graph renderer). Fixes #168 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_011M2KW5z36iHV1StfmfeMvU --- components/Visualization/svgs/LaTeXGraphSvgReact.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Visualization/svgs/LaTeXGraphSvgReact.js b/components/Visualization/svgs/LaTeXGraphSvgReact.js index 077d63aa..b0f56302 100644 --- a/components/Visualization/svgs/LaTeXGraphSvgReact.js +++ b/components/Visualization/svgs/LaTeXGraphSvgReact.js @@ -51,7 +51,7 @@ function LaTeXGraphSvgReact({ problemData }) { const rand = seededRandom(12345); - const nodes = problemData.nodes.map((n) => ({ + const nodes = (problemData.nodes || []).map((n) => ({ ...n, x: rand() * 10, y: rand() * 10, @@ -59,7 +59,7 @@ function LaTeXGraphSvgReact({ problemData }) { vy: 0, })); - const links = problemData.links; + const links = problemData.links || []; const iterations = 200; const repulsion = 0.4;