Permalink
Browse files

Fix Nullpointer warning

 Patch by: michaelortmann

* fix member access within null pointer warning
  • Loading branch information...
michaelortmann authored and vanosg committed Oct 4, 2018
1 parent 97c534b commit 79e6ec879eeaa90b94595e5be8e869c0121d52c6
Showing with 19 additions and 19 deletions.
  1. +19 −19 src/users.c
View
@@ -214,19 +214,17 @@ void check_expired_ignores()
}
}
/* Channel mask loaded from user file. This function is
* add(ban|invite|exempt)_fully merged into one. <cybah>
/* Channel mask loaded from user file. This function is
* add(ban|invite|exempt)_fully merged into one. <cybah>
*/
static void addmask_fully(struct chanset_t *chan, maskrec ** m,
maskrec ** global, char *mask, char *from, char *note,
time_t expire_time, int flags, time_t added,
time_t last)
static void addmask_fully(struct chanset_t *chan, maskrec ** m, char *mask,
char *from, char *note, time_t expire_time, int flags,
time_t added, time_t last)
{
maskrec *p = user_malloc(sizeof(maskrec));
maskrec **u = (chan) ? m : global;
p->next = *u;
*u = p;
p->next = *m;
*m = p;
p->expire = expire_time;
p->added = added;
p->lastactive = last;
@@ -271,7 +269,7 @@ static void restore_chanban(struct chanset_t *chan, char *host)
if (desc) {
*desc = 0;
desc++;
addmask_fully(chan, &chan->bans, &global_bans, host, user,
addmask_fully(chan, chan ? &chan->bans : &global_bans, host, user,
desc, atoi(expi), flags, atoi(add), atoi(last));
return;
}
@@ -282,8 +280,8 @@ static void restore_chanban(struct chanset_t *chan, char *host)
if (desc) {
*desc = 0;
desc++;
addmask_fully(chan, &chan->bans, &global_bans, host, add, desc,
atoi(expi), flags, now, 0);
addmask_fully(chan, chan ? &chan->bans : &global_bans, host, add,
desc, atoi(expi), flags, now, 0);
return;
}
}
@@ -325,8 +323,9 @@ static void restore_chanexempt(struct chanset_t *chan, char *host)
if (desc) {
*desc = 0;
desc++;
addmask_fully(chan, &chan->exempts, &global_exempts, host, user,
desc, atoi(expi), flags, atoi(add), atoi(last));
addmask_fully(chan, chan ? &chan->exempts : &global_exempts, host,
user, desc, atoi(expi), flags, atoi(add),
atoi(last));
return;
}
}
@@ -336,7 +335,7 @@ static void restore_chanexempt(struct chanset_t *chan, char *host)
if (desc) {
*desc = 0;
desc++;
addmask_fully(chan, &chan->exempts, &global_exempts, host, add,
addmask_fully(chan, chan ? &chan->exempts : &global_exempts, host, add,
desc, atoi(expi), flags, now, 0);
return;
}
@@ -379,8 +378,9 @@ static void restore_chaninvite(struct chanset_t *chan, char *host)
if (desc) {
*desc = 0;
desc++;
addmask_fully(chan, &chan->invites, &global_invites, host, user,
desc, atoi(expi), flags, atoi(add), atoi(last));
addmask_fully(chan, chan ? &chan->invites : &global_invites, host,
user, desc, atoi(expi), flags, atoi(add),
atoi(last));
return;
}
}
@@ -390,8 +390,8 @@ static void restore_chaninvite(struct chanset_t *chan, char *host)
if (desc) {
*desc = 0;
desc++;
addmask_fully(chan, &chan->invites, &global_invites, host, add,
desc, atoi(expi), flags, now, 0);
addmask_fully(chan, chan ? &chan->invites : &global_invites, host,
add, desc, atoi(expi), flags, now, 0);
return;
}
}

0 comments on commit 79e6ec8

Please sign in to comment.