Skip to content

Commit

Permalink
Add error boundary on node.DrawBackground (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Aug 5, 2024
1 parent 1b96c16 commit 50c4c87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ export class ComfyApp {
}
}

node.prototype.onDrawBackground = function (ctx) {
function unsafeDrawBackground(ctx) {
if (!this.flags.collapsed) {
let imgURLs = []
let imagesChanged = false
Expand Down Expand Up @@ -992,6 +992,14 @@ export class ComfyApp {
}
}
}

node.prototype.onDrawBackground = function (ctx) {
try {
unsafeDrawBackground.call(this, ctx)
} catch (error) {
console.error('Error drawing node background', error)
}
}
}

/**
Expand Down

0 comments on commit 50c4c87

Please sign in to comment.