Skip to content

Commit bf4eaa8

Browse files
committed
prevent infinite recursion
1 parent 15b46f7 commit bf4eaa8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/gregtech/api/capability/impl/ItemHandlerList.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,11 @@ public int size() {
137137

138138
@Override
139139
public boolean add(IItemHandler handler) {
140+
if (this == handler) {
141+
throw new IllegalArgumentException("Cannot add a handler list to itself!");
142+
}
140143
int s = size();
141144
if (handler instanceof ItemHandlerList list) {
142-
// possible infinite recursion
143-
// throw instead?
144145
addAll(s, list);
145146
} else {
146147
add(s, handler);

0 commit comments

Comments
 (0)