summaryrefslogtreecommitdiff
path: root/src/users.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/users.c')
-rw-r--r--src/users.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/users.c b/src/users.c
index b218c765a..bd15f8290 100644
--- a/src/users.c
+++ b/src/users.c
@@ -62,7 +62,14 @@ static User *new_user(const char *nick)
static void change_user_nick(User * user, const char *nick)
{
User **list;
- int is_same = (!stricmp(user->nick, nick) ? 1 : 0);
+ int is_same;
+
+ /* Sanity check to make sure we don't segfault */
+ if (!user || !nick || !*nick) {
+ return;
+ }
+
+ is_same = (!stricmp(user->nick, nick) ? 1 : 0);
if (user->prev)
user->prev->next = user->next;