From 58b36e35a16284c02bf3fe699056806f0981ae93 Mon Sep 17 00:00:00 2001 From: epochqwert Date: Mon, 18 May 2015 00:54:47 -0500 Subject: fixed a crash in !builtins and !aliases due to... something. --- segfault.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'segfault.c') diff --git a/segfault.c b/segfault.c index 535b0ba..ad57a21 100644 --- a/segfault.c +++ b/segfault.c @@ -560,6 +560,7 @@ void c_builtin(int fd,char *from,char *line,...) { void c_builtins(int fd,char *from,char *line,...) { char tmp[512]; + struct hitem *hi; struct entry *m; int i,j=0,k=0; if(!line){ @@ -571,13 +572,18 @@ void c_builtins(int fd,char *from,char *line,...) { snprintf(tmp,sizeof(tmp)-1,"builtins in bucket: %d",builtin.keys[i]); privmsg(fd,from,tmp); } - for(m=builtin.bucket[builtin.keys[i]]->ll;m;m=m->next) { - if(strcasestr(m->original,line) || *line=='*') { - snprintf(tmp,sizeof(tmp)-1," %s -> %p",m->original,m->target); - privmsg(fd,from,tmp); - j++; + hi=builtin.bucket[builtin.keys[i]]; + if(hi) { + for(m=builtin.bucket[builtin.keys[i]]->ll;m;m=m->next) { + if(strcasestr(m->original,line) || *line=='*') { + snprintf(tmp,sizeof(tmp)-1," %s -> %p",m->original,m->target); + privmsg(fd,from,tmp); + j++; + } + k++; } - k++; + } else { + privmsg(fd,from,"what the fuck? this bucket isn't set!"); } } snprintf(tmp,sizeof(tmp)-1,"found %d of %d in builtins",j,k); -- cgit v1.2.3