Issue #149 - avoid crash on null attr value
This commit is contained in:
parent
d38c5c5d78
commit
698396eaa0
10
src/attrs.c
10
src/attrs.c
|
@ -965,13 +965,15 @@ static void FreeAnchor(TidyDocImpl* doc, Anchor *a)
|
|||
|
||||
static uint anchorNameHash(ctmbstr s)
|
||||
{
|
||||
uint hashval;
|
||||
|
||||
for (hashval = 0; *s != '\0'; s++) {
|
||||
uint hashval = 0;
|
||||
/* Issue #149 - an inferred name can be null. avoid crash */
|
||||
if (s)
|
||||
{
|
||||
for ( ; *s != '\0'; s++) {
|
||||
tmbchar c = TY_(ToLower)( *s );
|
||||
hashval = c + 31*hashval;
|
||||
}
|
||||
|
||||
}
|
||||
return hashval % ANCHOR_HASH_SIZE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue