3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-20 01:40:06 +01:00

fix: recover from trimmed chunk (#2771)

- It's theoretically possible for the section FULL to return a null layer due to race condition with a trim operation
 - Locally cache result and if null, recover
 - I just had the error from #1592 again
 - This seems to have stopped the error, but adding logging did not log, so possibly some bigger bytecode changes?
 - Oh well
Dieser Commit ist enthalten in:
Jordan 2024-06-17 17:40:59 +02:00 committet von GitHub
Ursprung c7d6c907f1
Commit 6a54c5bcb5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -17,13 +17,23 @@ public abstract class CharBlocks implements IBlocks {
protected static final Section FULL = new Section() { protected static final Section FULL = new Section() {
@Override @Override
public char[] get(CharBlocks blocks, int layer) { public char[] get(CharBlocks blocks, int layer) {
return blocks.blocks[layer]; char[] arr = blocks.blocks[layer];
if (arr == null) {
// Chunk probably trimmed mid-operations, but do nothing about it to avoid other issues
return EMPTY.get(blocks, layer, false);
}
return arr;
} }
// Ignore aggressive switch here. // Ignore aggressive switch here.
@Override @Override
public char[] get(CharBlocks blocks, int layer, boolean aggressive) { public char[] get(CharBlocks blocks, int layer, boolean aggressive) {
return blocks.blocks[layer]; char[] arr = blocks.blocks[layer];
if (arr == null) {
// Chunk probably trimmed mid-operations, but do nothing about it to avoid other issues
return EMPTY.get(blocks, layer, false);
}
return arr;
} }
@Override @Override