diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-12 18:29:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-13 04:41:55 +0300 |
commit | 6bd4fff31e0b44b8b71876250c626fe8c15b4105 (patch) | |
tree | cdd7f984a0850864316ae23c33120b6d282b70ba /src/guild.cpp | |
parent | f457675ecfd704c99e84fe14f0a1dd49a69a9c76 (diff) | |
download | manaplus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.gz manaplus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.bz2 manaplus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.xz manaplus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.zip |
Add missing checks to some files and style fixes.
Diffstat (limited to 'src/guild.cpp')
-rw-r--r-- | src/guild.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/guild.cpp b/src/guild.cpp index a2d9149eb..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; } @@ -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); @@ -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; } } |