in string::search(), don't call memchr() if ptr == NULL.
noticed when tbl started logging lots of assertion errors generated from my local copy of libc which has (a modified) assert() tests throughout.
This commit is contained in:
parent
e48f29e82b
commit
781a4dc195
|
@ -270,7 +270,7 @@ void string::clear()
|
|||
|
||||
int string::search(char c) const
|
||||
{
|
||||
char *p = (char *)memchr(ptr, c, len);
|
||||
char *p = ptr ? (char *)memchr(ptr, c, len) : NULL;
|
||||
return p ? p - ptr : -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue