Skip to content

Commit

Permalink
fix: throw EntryMissingException for null entries in hash palette (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt authored Mar 18, 2024
1 parent 3a32d72 commit 25304ec
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.encoding.VarInts;
import net.minecraft.util.collection.IndexedIterable;
import net.minecraft.world.chunk.EntryMissingException;
import net.minecraft.world.chunk.Palette;
import net.minecraft.world.chunk.PaletteResizeListener;

Expand Down Expand Up @@ -120,11 +121,16 @@ private void resize(int neededCapacity) {
public T get(int id) {
T[] entries = this.entries;

T entry = null;
if (id >= 0 && id < entries.length) {
return entries[id];
entry = entries[id];
}

return null;
if (entry != null) {
return entry;
} else {
throw new EntryMissingException(id);
}
}

@Override
Expand Down

0 comments on commit 25304ec

Please sign in to comment.