mirror of
https://github.com/ViaVersion/ViaNBT.git
synced 2024-06-25 10:14:50 +02:00
Prevent adding self in compound tag
This commit is contained in:
parent
6ca922db67
commit
8149ec3bd0
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
|
||||
<groupId>com.viaversion</groupId>
|
||||
<artifactId>nbt</artifactId>
|
||||
<version>4.4.3</version>
|
||||
<version>4.4.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ViaNBT</name>
|
||||
|
|
|
@ -330,6 +330,9 @@ public final class CompoundTag extends Tag implements Iterable<Entry<String, Tag
|
|||
*/
|
||||
@Nullable
|
||||
public <T extends Tag> T put(String tagName, T tag) {
|
||||
if (tag == this) {
|
||||
throw new IllegalArgumentException("Cannot add a tag to itself");
|
||||
}
|
||||
return (T) this.value.put(tagName, tag);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user