- for (cip=chantable[i];cip;cip=ncip) {
- ncip = cip->next;
- if (cip != NULL && cip->channel != NULL && cip->marker == localdata->marker) {
- for (j=0;j<cip->channel->users->hashsize;j++) {
- if (cip->channel->users->content[j]==nouser)
- continue;
-
- if ((np=getnickbynumeric(cip->channel->users->content[j]))) {
- if (!IsOper(np) && !IsService(np) && !IsXOper(np)) {
- np->marker=nickmarker;
- }
- else
- safe++;
- }
- }
- }
- }
- }
- for (i=0;i<NICKHASHSIZE;i++) {
- for(np=nicktable[i];np;np=nnp) {
- nnp = np->next;
- if (np->marker == nickmarker) {
- nssnprintf(msgbuf, sizeof(msgbuf), localdata->reason, np);
- killuser(NULL, np, "%s", msgbuf);
+ for (cip=chantable[i];cip;cip=cip->next) {
+ /* Skip empty and non-matching channels */
+ if (!cip->channel || cip->marker != localdata->marker)
+ continue;
+
+ for (j=0;j<cip->channel->users->hashsize;j++) {
+ if (cip->channel->users->content[j]==nouser)
+ continue;
+
+ if ((np=getnickbynumeric(cip->channel->users->content[j])))
+ np->marker=nickmarker;