mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
fix: guard getActiveNodes against undefined graph.nodes
This commit is contained in:
@@ -287,6 +287,7 @@ export function removeNode(graph, nodeId, visited = new Set()) {
|
||||
* @returns {object[]}
|
||||
*/
|
||||
export function getActiveNodes(graph, typeFilter = null) {
|
||||
if (!Array.isArray(graph?.nodes)) return [];
|
||||
let nodes = graph.nodes.filter((n) => !n.archived);
|
||||
if (typeFilter) {
|
||||
nodes = nodes.filter((n) => n.type === typeFilter);
|
||||
|
||||
Reference in New Issue
Block a user