Fix issue when overflow happens

This commit is contained in:
mcrcortex
2024-12-03 23:34:16 +10:00
parent 9c05fdc11e
commit 775bf46b8e

View File

@@ -126,7 +126,7 @@ public class SaveLoadSystem {
int nonEmptyBlockCount = 0;
for (int i = 0; i < WorldSection.SECTION_VOLUME; i++) {
long state = lut[MemoryUtil.memGetShort(ptr)]; ptr += 2; if (VERIFY_MEMORY_ACCESS && data.size<=(ptr-data.address)) throw new IllegalStateException("Memory access OOB");
long state = lut[Short.toUnsignedInt(MemoryUtil.memGetShort(ptr))]; ptr += 2; if (VERIFY_MEMORY_ACCESS && data.size<=(ptr-data.address)) throw new IllegalStateException("Memory access OOB");
nonEmptyBlockCount += Mapper.isAir(state)?0:1;
section.data[z2lin(i)] = state;
}