Skip to content

Commit 50c4c87

Browse files
authored
Add error boundary on node.DrawBackground (#311)
1 parent 1b96c16 commit 50c4c87

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/scripts/app.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ export class ComfyApp {
657657
}
658658
}
659659

660-
node.prototype.onDrawBackground = function (ctx) {
660+
function unsafeDrawBackground(ctx) {
661661
if (!this.flags.collapsed) {
662662
let imgURLs = []
663663
let imagesChanged = false
@@ -992,6 +992,14 @@ export class ComfyApp {
992992
}
993993
}
994994
}
995+
996+
node.prototype.onDrawBackground = function (ctx) {
997+
try {
998+
unsafeDrawBackground.call(this, ctx)
999+
} catch (error) {
1000+
console.error('Error drawing node background', error)
1001+
}
1002+
}
9951003
}
9961004

9971005
/**

0 commit comments

Comments
 (0)