Fixed division with a 0 error

This commit is contained in:
Anon 2023-11-25 14:02:06 +01:00
parent 93112d2c02
commit 549f39fab1

View file

@ -959,9 +959,10 @@ namespace MinecraftClient.Protocol.Handlers
break;
case PacketTypesIn.ChunkBatchFinished:
dataTypes.ReadNextVarInt(packetData); // Number of chunks received
var time = (DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastCHunkBatchStartedAt);
SendChunkBatchReceived(
// ReSharper disable once PossibleLossOfFraction
25 / (DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastCHunkBatchStartedAt)
25 / time == 0 ? 5 : time
);
break;
case PacketTypesIn.ChunkBatchStarted: