Skip to content

Commit 16cc9be

Browse files
committed
bugfix: VectorCommunicationCache: Fixed vector usage.
Vector item was used before check the index. Also change type of index to size_t.
1 parent ce78412 commit 16cc9be

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/inet/physicallayer/wireless/common/communicationcache/VectorCommunicationCache.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ void VectorCommunicationCache::removeRadio(const IRadio *radio)
8080
{
8181
auto radioCacheEntry = getRadioCacheEntry(radio);
8282
radioCacheEntry->radio = nullptr;
83-
int radioCount = 0;
84-
while (radioCache[radioCount].radio == nullptr && radioCount < (int)radioCache.size())
83+
size_t radioCount = 0;
84+
while (radioCount < radioCache.size() && radioCache[radioCount].radio == nullptr)
8585
radioCount++;
8686
if (radioCount != 0) {
8787
ASSERT(baseRadioId != -1);

0 commit comments

Comments
 (0)