This shouldn't really be necessary since a parsed document
should have at least a root element. In practice, however, tinyxml2
sometimes returns success on LoadFile() and NULL on RootElement().
Bug:
17504829
return NULL;
}
+ XMLElement *rootElement = document.RootElement();
+ if (!rootElement) {
+ ALOGE("%s unable to find root element; assuming corrupted config file.", __func__);
+ return NULL;
+ }
+
config_t *config = config_new_empty();
if (!config) {
ALOGE("%s unable to allocate config object.", __func__);
return NULL;
}
- XMLElement *rootElement = document.RootElement();
for (XMLElement *i = rootElement->FirstChildElement(); i != NULL; i = i->NextSiblingElement())
for (XMLElement *j = i->FirstChildElement(); j != NULL; j = j->NextSiblingElement()) {
const char *section = j->Attribute("Tag");