Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
Add disposal checks.
Dieser Commit ist enthalten in:
Ursprung
9815837472
Commit
850b2f7958
@ -1,5 +1,6 @@
|
|||||||
package com.velocitypowered.natives.compression;
|
package com.velocitypowered.natives.compression;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.util.zip.DataFormatException;
|
import java.util.zip.DataFormatException;
|
||||||
@ -18,6 +19,7 @@ public class NativeVelocityCompressor implements VelocityCompressor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inflate(ByteBuf source, ByteBuf destination) throws DataFormatException {
|
public void inflate(ByteBuf source, ByteBuf destination) throws DataFormatException {
|
||||||
|
ensureNotDisposed();
|
||||||
source.memoryAddress();
|
source.memoryAddress();
|
||||||
destination.memoryAddress();
|
destination.memoryAddress();
|
||||||
|
|
||||||
@ -38,6 +40,7 @@ public class NativeVelocityCompressor implements VelocityCompressor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deflate(ByteBuf source, ByteBuf destination) throws DataFormatException {
|
public void deflate(ByteBuf source, ByteBuf destination) throws DataFormatException {
|
||||||
|
ensureNotDisposed();
|
||||||
source.memoryAddress();
|
source.memoryAddress();
|
||||||
destination.memoryAddress();
|
destination.memoryAddress();
|
||||||
|
|
||||||
@ -56,6 +59,10 @@ public class NativeVelocityCompressor implements VelocityCompressor {
|
|||||||
deflate.finished = false;
|
deflate.finished = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ensureNotDisposed() {
|
||||||
|
Preconditions.checkState(!disposed, "Object already disposed");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (!disposed) {
|
if (!disposed) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren