Skip to content

Commit

Permalink
[TS] Add null check in graph to prompt (#2727)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfiltered authored Feb 25, 2025
1 parent 101e8de commit c20ea0c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/executionUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export const graphToPrompt = async (
if (!parent) continue

let link = node.getInputLink(i)
while (parent.mode === LGraphEventMode.BYPASS || parent.isVirtualNode) {
while (
parent?.mode === LGraphEventMode.BYPASS ||
parent?.isVirtualNode
) {
if (!link) break

if (parent.isVirtualNode) {
Expand All @@ -95,7 +98,7 @@ export const graphToPrompt = async (
const indexes = [link.origin_slot].concat(parentInputIndexes)

const matchingIndex = indexes.find(
(index) => parent.inputs[index]?.type === input.type
(index) => parent?.inputs[index]?.type === input.type
)
// No input types match
if (matchingIndex === undefined) break
Expand Down

0 comments on commit c20ea0c

Please sign in to comment.