Skip to content

Commit

Permalink
CompoundTag: repeat 3e0d9ef for 0.2 legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Dec 16, 2021
1 parent 5073419 commit 8567c65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tag/CompoundTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ public function read(NBTStream $nbt, ReaderTracker $tracker) : void{
$tag = $nbt->readTag($tracker);
if($tag !== null){
if(isset($this->value[$tag->__name])){
throw new \UnexpectedValueException("Duplicate key \"$tag->__name\"");
//this is technically a corruption case, but it's very common on older PM worlds (pretty much every
//furnace in PM worlds prior to 2017 is affected), and since we can't extricate this borked data
//from the rest in Anvil/McRegion worlds, we can't barf on this - it would result in complete loss
//of the chunk.
//TODO: add a flag to enable throwing on this (strict mode)
continue;
}
$this->value[$tag->__name] = $tag;
}
Expand Down

0 comments on commit 8567c65

Please sign in to comment.