Skip to content

Commit 8731bf5

Browse files
committed
Fix - protection against endless recursion #406
If list of primitives contains itself
1 parent 82da36f commit 8731bf5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

modules/gpad/TPadPainter.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,10 @@ class TPadPainter extends ObjectPainter {
12351235
if (!lst)
12361236
return;
12371237
for (let i = 0; i < lst.arr?.length; ++i) {
1238-
if (this.checkSpecial(lst.arr[i])) {
1238+
if (lst.arr[i] === lst) {
1239+
lst.arr[i] = null;
1240+
console.error('list of primitives includes itself - endless recursion');
1241+
} else if (this.checkSpecial(lst.arr[i])) {
12391242
lst.arr[i].$special = true; // mark object as special one, do not use in drawing
12401243
if (count_specials)
12411244
this.#num_specials++;

0 commit comments

Comments
 (0)