src/lib/common.c 1.139
1.139 2009/11/23 18:02:16 tdreszer
Tiny bit more protection for findWordByDilimiter()
Index: src/lib/common.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/common.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -b -B -U 4 -r1.138 -r1.139
--- src/lib/common.c 22 Nov 2009 00:18:03 -0000 1.138
+++ src/lib/common.c 23 Nov 2009 18:02:16 -0000 1.139
@@ -1001,9 +1001,9 @@
Comparison is case sensitive. Delimit of ' ' uses isspace() */
{
int ix;
char *p=line;
-while(*p!='\0')
+while(p!=NULL && *p!='\0')
{
for (ix = 0;
word[ix] != '\0' && word[ix] == *p;
ix++,p++); // advance as long as they match
@@ -1022,10 +1022,8 @@
{
p++;
continue; // delimited so start again after delimit
}
- else
- break;
}
return NULL;
}