if there are no active agents in list begin() iterator should be end()

This commit is contained in:
Stephen Birarda 2013-05-06 13:11:40 -07:00
parent f3a9dcf777
commit 499899c6e0

View file

@ -64,8 +64,7 @@ AgentList::AgentList(char newOwnerType, unsigned int newSocketListenPort) :
agentSocket(newSocketListenPort),
ownerType(newOwnerType),
socketListenPort(newSocketListenPort),
lastAgentId(0)
{
lastAgentId(0) {
pthread_mutex_init(&mutex, 0);
}
@ -483,7 +482,8 @@ AgentList::iterator AgentList::begin() const {
}
}
return AgentListIterator(this, 0);
// there's no alive agent to start from - return the end
return end();
}
AgentList::iterator AgentList::end() const {