nghttp: Fix crash if attrs parameter of get_attr() is nullptr
This commit is contained in:
parent
59397e80be
commit
bfe7a9af00
|
@ -48,12 +48,15 @@ HtmlParser::~HtmlParser()
|
||||||
namespace {
|
namespace {
|
||||||
const char* get_attr(const xmlChar **attrs, const char *name)
|
const char* get_attr(const xmlChar **attrs, const char *name)
|
||||||
{
|
{
|
||||||
|
if(attrs == nullptr) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
for(; *attrs; attrs += 2) {
|
for(; *attrs; attrs += 2) {
|
||||||
if(util::strieq(reinterpret_cast<const char*>(attrs[0]), name)) {
|
if(util::strieq(reinterpret_cast<const char*>(attrs[0]), name)) {
|
||||||
return reinterpret_cast<const char*>(attrs[1]);
|
return reinterpret_cast<const char*>(attrs[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue