summaryrefslogtreecommitdiff
path: root/src/guild.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/guild.cpp')
-rw-r--r--src/guild.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/guild.cpp b/src/guild.cpp
index 98e5bb519..5d129e11e 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -124,7 +124,7 @@ GuildMember *Guild::getMember(int id) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mId == id)
+ if ((*itr) && (*itr)->mId == id)
return (*itr);
++itr;
}
@@ -138,7 +138,7 @@ GuildMember *Guild::getMember(int accountId, int charId) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mId == accountId && (*itr)->mCharId == charId)
+ if ((*itr) && (*itr)->mId == accountId && (*itr)->mCharId == charId)
return (*itr);
++itr;
}
@@ -152,7 +152,7 @@ GuildMember *Guild::getMember(const std::string &name) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->getName() == name)
+ if ((*itr) && (*itr)->getName() == name)
return (*itr);
++itr;
}
@@ -170,9 +170,9 @@ void Guild::removeMember(GuildMember *member)
(*itr)->mCharId == member->mCharId &&
(*itr)->getName() == member->getName())
{
- GuildMember *member = *itr;
+ GuildMember *m = *itr;
mMembers.erase(itr);
- delete member;
+ delete m;
return;
}
++itr;
@@ -189,7 +189,7 @@ void Guild::removeMember(int id)
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mId == id)
+ if ((*itr) && (*itr)->mId == id)
{
GuildMember *member = *itr;
mMembers.erase(itr);
@@ -212,7 +212,7 @@ void Guild::removeMember(const std::string &name)
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->getName() == name)
+ if ((*itr) && (*itr)->getName() == name)
{
GuildMember *member = *itr;
mMembers.erase(itr);
@@ -230,8 +230,8 @@ void Guild::removeFromMembers()
if (!actorSpriteManager)
return;
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
+ MemberList::const_iterator itr = mMembers.begin();
+ MemberList::const_iterator itr_end = mMembers.end();
while (itr != itr_end)
{
Being *b = actorSpriteManager->findBeing((*itr)->getID());
@@ -262,7 +262,7 @@ bool Guild::isMember(GuildMember *member) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mId == member->mId &&
+ if ((*itr) && (*itr)->mId == member->mId &&
(*itr)->getName() == member->getName())
{
return true;
@@ -279,7 +279,7 @@ bool Guild::isMember(int id) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mId == id)
+ if ((*itr) && (*itr)->mId == id)
return true;
++itr;
}
@@ -293,7 +293,7 @@ bool Guild::isMember(const std::string &name) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->getName() == name)
+ if ((*itr) && (*itr)->getName() == name)
return true;
++itr;
}
@@ -309,7 +309,8 @@ void Guild::getNames(std::vector<std::string> &names) const
while (it != it_end)
{
- names.push_back((*it)->getName());
+ if (*it)
+ names.push_back((*it)->getName());
++it;
}
}
@@ -321,7 +322,7 @@ void Guild::addPos(int id, std::string name)
Guild *Guild::getGuild(short id)
{
- GuildMap::iterator it = guilds.find(id);
+ GuildMap::const_iterator it = guilds.find(id);
if (it != guilds.end())
return it->second;