[TS] Fix nullability (#2702)

`LGraphCanvas.graph` may explicity set to null by litegraph.
This commit is contained in:
filtered
2025-02-24 22:00:19 +11:00
committed by GitHub
parent 822a8e02f8
commit 97f9d654b6
2 changed files with 3 additions and 3 deletions

View File

@@ -337,7 +337,7 @@ export function useCoreCommands(): ComfyCommand[] {
'Comfy.GroupSelectedNodes.Padding'
)
group.resizeTo(canvas.selectedItems, padding)
canvas.graph.add(group)
canvas.graph?.add(group)
useTitleEditorStore().titleEditorTarget = group
}
},

View File

@@ -66,8 +66,8 @@ export const usePaste = () => {
const newNode = LiteGraph.createNode('LoadImage')
// @ts-expect-error array to Float32Array
newNode.pos = [...canvas.graph_mouse]
imageNode = graph.add(newNode) ?? null
graph.change()
imageNode = graph?.add(newNode) ?? null
graph?.change()
}
pasteItemOnNode(items, imageNode)
return