diff options
Diffstat (limited to 'core/fxcrt/xml/cfx_xmlelement.cpp')
-rw-r--r-- | core/fxcrt/xml/cfx_xmlelement.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp index 74351b8c58..4bb4eae1bd 100644 --- a/core/fxcrt/xml/cfx_xmlelement.cpp +++ b/core/fxcrt/xml/cfx_xmlelement.cpp @@ -125,11 +125,8 @@ CFX_XMLElement* CFX_XMLElement::GetFirstChildNamed( CFX_XMLElement* CFX_XMLElement::GetNthChildNamed(const WideStringView& name, size_t idx) const { for (auto* child = GetFirstChild(); child; child = child->GetNextSibling()) { - if (child->GetType() != FX_XMLNODE_Element) - continue; - - CFX_XMLElement* elem = static_cast<CFX_XMLElement*>(child); - if (elem->name_ != name) + CFX_XMLElement* elem = ToXMLElement(child); + if (!elem || elem->name_ != name) continue; if (idx == 0) return elem; |