Safe iterator pointer.

This commit is contained in:
momo5502 2016-02-15 20:32:41 +01:00
parent 8b932677f5
commit 55b8d2c5de
2 changed files with 6 additions and 8 deletions

View File

@ -330,13 +330,13 @@ namespace Components
std::vector<int> missingPackets; std::vector<int> missingPackets;
for (int j = 0; j < i->maxParts; ++j) for (int j = 0; j < i->maxParts; ++j)
{ {
if (!Download::HasReceivedPacket(&*i, j)) if (!Download::HasReceivedPacket(&(*i), j))
{ {
missingPackets.push_back(j); missingPackets.push_back(j);
} }
} }
Download::RequestMissingPackets(&*i, missingPackets); Download::RequestMissingPackets(&(*i), missingPackets);
} }
} }
} }
@ -354,10 +354,10 @@ namespace Components
int packets = 0; int packets = 0;
for (int j = 0; j < i->maxParts && packets <= FRAME_PACKET_LIMIT && i->acknowledged; ++j) for (int j = 0; j < i->maxParts && packets <= FRAME_PACKET_LIMIT && i->acknowledged; ++j)
{ {
if (!Download::HasSentPacket(&*i, j)) if (!Download::HasSentPacket(&(*i), j))
{ {
//Logger::Print("Sending packet...\n"); //Logger::Print("Sending packet...\n");
Download::SendPacket(&*i, j); Download::SendPacket(&(*i), j);
packets++; packets++;
} }
} }

View File

@ -69,8 +69,7 @@ namespace Components
{ {
if (i->address == address) if (i->address == address)
{ {
// I don't know if that's safe, but we'll see that later... return &(*i);
return &*i;
} }
} }
@ -82,8 +81,7 @@ namespace Components
{ {
if (i->address == address) if (i->address == address)
{ {
// I don't know if that's safe, but we'll see that later... return &(*i);
return &*i;
} }
} }