Return false instead of undefined in depthFirstSearchMatchTwoPaths bounds checks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 18:40:54 +08:00
parent 7a1b996877
commit 1c70c9b3af

View File

@@ -193,10 +193,10 @@ export const useMapPathStore = defineStore('mapPathStore', {
},
depthFirstSearchMatchTwoPaths(curPath, curPathIndex, curButton, listIndex, nodeIndex) {
if (listIndex >= curButton.length) { // Bounds check to prevent out-of-range access
return; // nodeIndex is the path index in the list after selecting one of the five buttons
return false; // nodeIndex is the path index in the list after selecting one of the five buttons
}
if (nodeIndex >= curButton[listIndex].length) { // Bounds check to prevent out-of-range access
return; // The node index within this path in the list
return false; // The node index within this path in the list
}
// If `curPath` and `curButton[listIndex]` fully match
if (curPathIndex === curPath.length || nodeIndex === curButton[listIndex].length) {
@@ -205,7 +205,7 @@ export const useMapPathStore = defineStore('mapPathStore', {
// Bounds check to prevent out-of-range access
if (curPathIndex >= curPath.length || nodeIndex >= curButton[listIndex].length) {
return;
return false;
}
const nodeLabel = curPath[curPathIndex].data('label');