From 9641fd1e0e4a452c018f4378963682c00e9d6a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 9 Mar 2026 18:25:49 +0800 Subject: [PATCH] Add null/bounds guards for curButton and curPath in mapPathStore Co-Authored-By: Claude Opus 4.6 --- src/stores/mapPathStore.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stores/mapPathStore.ts b/src/stores/mapPathStore.ts index b698273..cccb723 100644 --- a/src/stores/mapPathStore.ts +++ b/src/stores/mapPathStore.ts @@ -84,6 +84,7 @@ export const useMapPathStore = defineStore('mapPathStore', { }); for (let i = 0; i < INSIGHTS_FIELDS_AND_LABELS.length; i++) { const curButton = this.insights[INSIGHTS_FIELDS_AND_LABELS[i][0]]; + if (!curButton) continue; this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[i][0]] = {}; // first layer index for (let listIndex = 0; listIndex < curButton.length; listIndex++) { @@ -164,10 +165,12 @@ export const useMapPathStore = defineStore('mapPathStore', { matchGraphPathWithInsightsPath() { for (let whichPath = 0; whichPath < this.allPaths.length; whichPath++) { const curPath = this.allPaths[whichPath]; + if (curPath.length < 2) continue; const curPathByEdge = this.allPathsByEdge[whichPath]; // For the first node in this path, find which insights starting point it corresponds to for (let i = 0; i < INSIGHTS_FIELDS_AND_LABELS.length; i++) { const curButton = this.insights[INSIGHTS_FIELDS_AND_LABELS[i][0]]; + if (!curButton) continue; for (let listIndex = 0; listIndex < curButton.length; listIndex++) { for (let nodeIndex = 0; nodeIndex < curButton[listIndex].length; nodeIndex++) { if (curPath[1].data('label') === curButton[listIndex][nodeIndex]) {