Skip to content

Commit

Permalink
Fix Nullpointer warning
Browse files Browse the repository at this point in the history
 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 79e6ec8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/users.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 79e6ec8

Please sign in to comment.