From a720b14fa54b0a77bb3a01b0c2f82196ecffde59 Mon Sep 17 00:00:00 2001 From: Rodrigo Alfonso Date: Sat, 25 Jan 2025 02:26:44 -0300 Subject: [PATCH] Fixing warnings --- lib/LinkWirelessOpenSDK.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/LinkWirelessOpenSDK.hpp b/lib/LinkWirelessOpenSDK.hpp index 7a8549b..0637d84 100644 --- a/lib/LinkWirelessOpenSDK.hpp +++ b/lib/LinkWirelessOpenSDK.hpp @@ -69,7 +69,7 @@ class LinkWirelessOpenSDK { static SequenceNumber fromPacketId(u32 packetId) { return SequenceNumber{.n = ((packetId + 4) / 4) % 4, - packetId % 4, + .phase = packetId % 4, .commState = COMMUNICATING}; } @@ -557,7 +557,9 @@ class LinkWirelessOpenSDK { if (canSendInflightPackets && pendingCount > 0 && pendingCount < MaxInflightPackets) { - return pendingTransferList.max()->cursor + 1; + auto max = pendingTransferList.max(); + // (`max` is never null here! but the compiler complains...) + return max != nullptr ? max->cursor + 1 : 0; } else { auto minWithoutAck = pendingTransferList.minWithoutAck(); return minWithoutAck != nullptr ? minWithoutAck->cursor : cursor;