Skip to content

Commit

Permalink
Fixed division with a 0 error
Browse files Browse the repository at this point in the history
  • Loading branch information
milutinke committed Nov 25, 2023
1 parent 93112d2 commit 549f39f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MinecraftClient/Protocol/Handlers/Protocol18.cs
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,10 @@ private bool HandlePlayPackets(int packetId, Queue<byte> packetData)
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:
Expand Down

0 comments on commit 549f39f

Please sign in to comment.