mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
fix: do not StackOverflow when getting a section in FULL after awkward trim (#2863)
This commit is contained in:
parent
1a827fa8c1
commit
fcbd346d8f
@ -31,7 +31,9 @@ public abstract class CharBlocks implements IBlocks {
|
|||||||
char[] arr = blocks.blocks[layer];
|
char[] arr = blocks.blocks[layer];
|
||||||
if (arr == null) {
|
if (arr == null) {
|
||||||
// Chunk probably trimmed mid-operations, but do nothing about it to avoid other issues
|
// Chunk probably trimmed mid-operations, but do nothing about it to avoid other issues
|
||||||
return EMPTY.get(blocks, layer, false);
|
synchronized (blocks.sectionLocks[layer]) {
|
||||||
|
return getSkipFull(blocks, layer, aggressive);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
@ -54,22 +56,7 @@ public abstract class CharBlocks implements IBlocks {
|
|||||||
if (blocks.sections[layer] == FULL) {
|
if (blocks.sections[layer] == FULL) {
|
||||||
return FULL.get(blocks, layer);
|
return FULL.get(blocks, layer);
|
||||||
}
|
}
|
||||||
char[] arr = blocks.blocks[layer];
|
return getSkipFull(blocks, layer, aggressive);
|
||||||
if (arr == null) {
|
|
||||||
arr = blocks.blocks[layer] = blocks.update(layer, null, aggressive);
|
|
||||||
if (arr == null) {
|
|
||||||
throw new IllegalStateException("Array cannot be null: " + blocks.getClass());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
blocks.blocks[layer] = blocks.update(layer, arr, aggressive);
|
|
||||||
if (blocks.blocks[layer] == null) {
|
|
||||||
throw new IllegalStateException("Array cannot be null (update): " + blocks.getClass());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (blocks.blocks[layer] != null) {
|
|
||||||
blocks.sections[layer] = FULL;
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,6 +249,25 @@ public abstract class CharBlocks implements IBlocks {
|
|||||||
get(blocks, layer)[index] = value;
|
get(blocks, layer)[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char[] getSkipFull(CharBlocks blocks, int layer, boolean aggressive) {
|
||||||
|
char[] arr = blocks.blocks[layer];
|
||||||
|
if (arr == null) {
|
||||||
|
arr = blocks.blocks[layer] = blocks.update(layer, null, aggressive);
|
||||||
|
if (arr == null) {
|
||||||
|
throw new IllegalStateException("Array cannot be null: " + blocks.getClass());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
blocks.blocks[layer] = blocks.update(layer, arr, aggressive);
|
||||||
|
if (blocks.blocks[layer] == null) {
|
||||||
|
throw new IllegalStateException("Array cannot be null (update): " + blocks.getClass());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (blocks.blocks[layer] != null) {
|
||||||
|
blocks.sections[layer] = FULL;
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user