- if (!strcmp(type, "title"))
- res->title = nmem_strdup(se->nmem,
- value = xmlNodeListGetString(xdoc, n->children, 0));
-
- relevance_countwords(se->relevance, head, value, 4);
+ if (type && !strcmp(type, "title"))
+ {
+ xmlChar *value = xmlNodeListGetString(xdoc, n->children, 0);
+ if (value)
+ {
+ res->title = nmem_strdup(se->nmem, value);
+ relevance_countwords(se->relevance, head, value, 4);
+ xmlFree(value);
+ }
+ }