From 554308f654ab97d2964daf51b13525f400f9a2e4 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 29 Sep 2019 19:52:05 +0100 Subject: 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. --- include/users.h | 6 +++--- 1 file 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(u) : NULL; + return (u != NULL && u->usertype == USERTYPE_LOCAL) ? static_cast(u) : NULL; } /** Is a remote user */ inline RemoteUser* IS_REMOTE(User* u) { - return u->usertype == USERTYPE_REMOTE ? static_cast(u) : NULL; + return (u != NULL && u->usertype == USERTYPE_REMOTE) ? static_cast(u) : NULL; } /** Is a server fakeuser */ inline FakeUser* IS_SERVER(User* u) { - return u->usertype == USERTYPE_SERVER ? static_cast(u) : NULL; + return (u != NULL && u->usertype == USERTYPE_SERVER) ? static_cast(u) : NULL; } inline bool User::IsModeSet(const ModeHandler* mh) const -- cgit v1.2.3