summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-09-29 19:52:05 +0100
committerPeter Powell <petpow@saberuk.com>2019-09-29 19:52:05 +0100
commit554308f654ab97d2964daf51b13525f400f9a2e4 (patch)
tree8d2d0e42988fa0a55dfb0f7c55937030edff5698 /include
parente96f1bb1571c864705c20a976ff64bb40d6b8d06 (diff)
Add null pointer checks to IS_{LOCAL,REMOTE,SERVER}.
I don't know of any places this causes issues but its better to be safe than sorry.
Diffstat (limited to 'include')
-rw-r--r--include/users.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/users.h b/include/users.h
index 6b7e18953..e58e8e316 100644
--- a/include/users.h
+++ b/include/users.h
@@ -906,17 +906,17 @@ class CoreExport FakeUser : public User
/** Is a local user */
inline LocalUser* IS_LOCAL(User* u)
{
- return u->usertype == USERTYPE_LOCAL ? static_cast<LocalUser*>(u) : NULL;
+ return (u != NULL && u->usertype == USERTYPE_LOCAL) ? static_cast<LocalUser*>(u) : NULL;
}
/** Is a remote user */
inline RemoteUser* IS_REMOTE(User* u)
{
- return u->usertype == USERTYPE_REMOTE ? static_cast<RemoteUser*>(u) : NULL;
+ return (u != NULL && u->usertype == USERTYPE_REMOTE) ? static_cast<RemoteUser*>(u) : NULL;
}
/** Is a server fakeuser */
inline FakeUser* IS_SERVER(User* u)
{
- return u->usertype == USERTYPE_SERVER ? static_cast<FakeUser*>(u) : NULL;
+ return (u != NULL && u->usertype == USERTYPE_SERVER) ? static_cast<FakeUser*>(u) : NULL;
}
inline bool User::IsModeSet(const ModeHandler* mh) const