fix[orm]: 修复FileChannelMap空指针异常

This commit is contained in:
jaysunxiao
2021-08-28 12:39:48 +08:00
parent 294a9e3334
commit 3cdf9b6131
@@ -66,13 +66,13 @@ public class FileChannelMap<V extends IPacket> implements LpMap<V>, Closeable {
indexFileRandomAccess.writeLong(0L);
}
maxIndex = readMaxIndex();
var protocolId = ProtocolAnalysis.getProtocolIdByClass(clazz);
protocolRegistration = ProtocolManager.getProtocol(protocolId);
indexBuffer = ByteBufAllocator.DEFAULT.ioBuffer(16);
dbBuffer = ByteBufAllocator.DEFAULT.ioBuffer(100);
maxIndex = readMaxIndex();
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -120,6 +120,7 @@ public class FileChannelMap<V extends IPacket> implements LpMap<V>, Closeable {
}
try {
clearByteBuf();
indexBuffer.writeBytes(indexFileChannel, key * 16L, 16);
var packetPosition = indexBuffer.readLong();
var packetSize = indexBuffer.readLong();