Add null/bounds guards for curButton and curPath in mapPathStore
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,7 @@ export const useMapPathStore = defineStore('mapPathStore', {
|
|||||||
});
|
});
|
||||||
for (let i = 0; i < INSIGHTS_FIELDS_AND_LABELS.length; i++) {
|
for (let i = 0; i < INSIGHTS_FIELDS_AND_LABELS.length; i++) {
|
||||||
const curButton = this.insights[INSIGHTS_FIELDS_AND_LABELS[i][0]];
|
const curButton = this.insights[INSIGHTS_FIELDS_AND_LABELS[i][0]];
|
||||||
|
if (!curButton) continue;
|
||||||
this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[i][0]] = {}; // first layer index
|
this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[i][0]] = {}; // first layer index
|
||||||
|
|
||||||
for (let listIndex = 0; listIndex < curButton.length; listIndex++) {
|
for (let listIndex = 0; listIndex < curButton.length; listIndex++) {
|
||||||
@@ -164,10 +165,12 @@ export const useMapPathStore = defineStore('mapPathStore', {
|
|||||||
matchGraphPathWithInsightsPath() {
|
matchGraphPathWithInsightsPath() {
|
||||||
for (let whichPath = 0; whichPath < this.allPaths.length; whichPath++) {
|
for (let whichPath = 0; whichPath < this.allPaths.length; whichPath++) {
|
||||||
const curPath = this.allPaths[whichPath];
|
const curPath = this.allPaths[whichPath];
|
||||||
|
if (curPath.length < 2) continue;
|
||||||
const curPathByEdge = this.allPathsByEdge[whichPath];
|
const curPathByEdge = this.allPathsByEdge[whichPath];
|
||||||
// For the first node in this path, find which insights starting point it corresponds to
|
// 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++) {
|
for (let i = 0; i < INSIGHTS_FIELDS_AND_LABELS.length; i++) {
|
||||||
const curButton = this.insights[INSIGHTS_FIELDS_AND_LABELS[i][0]];
|
const curButton = this.insights[INSIGHTS_FIELDS_AND_LABELS[i][0]];
|
||||||
|
if (!curButton) continue;
|
||||||
for (let listIndex = 0; listIndex < curButton.length; listIndex++) {
|
for (let listIndex = 0; listIndex < curButton.length; listIndex++) {
|
||||||
for (let nodeIndex = 0; nodeIndex < curButton[listIndex].length; nodeIndex++) {
|
for (let nodeIndex = 0; nodeIndex < curButton[listIndex].length; nodeIndex++) {
|
||||||
if (curPath[1].data('label') === curButton[listIndex][nodeIndex]) {
|
if (curPath[1].data('label') === curButton[listIndex][nodeIndex]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user