Improve null checks and index validation in StaticPoolPacketManager

This commit is contained in:
João Brázio committed 2026-09-04 21:03:06 +01:00
1 parent 4606918fad
commit a4d1854a77
2 files changed
+11 -3

No files matched your search

+4 -1
View File
@@ -14,7 +14,10 @@ public:
bool add(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for);
int count() const { return _num; }
int countBefore(uint32_t now) const;
mesh::Packet* itemAt(int i) const { return _table[i]; }
mesh::Packet* itemAt(int i) const {
if (i < 0 || i >= _num) return NULL;
return _table[i];
}
mesh::Packet* removeByIdx(int i);
};