[dav] have GetStatusTag() iterate over XML elements, not nodes.
authorJonathan Marshall <jmarshall@xbmc.org>
Tue, 15 Jul 2014 04:15:18 +0000 (16:15 +1200)
committerJonathan Marshall <jmarshall@xbmc.org>
Tue, 15 Jul 2014 04:15:22 +0000 (16:15 +1200)
As things are, if there are no children of the passed element, we'll have a NULL dereference.

xbmc/filesystem/DAVCommon.cpp

index 179e98c..6fdb35d 100644 (file)
@@ -70,11 +70,11 @@ std::string CDAVCommon::GetStatusTag(const TiXmlElement *pElement)
 {
   const TiXmlElement *pChild;
 
-  for (pChild = pElement->FirstChild()->ToElement(); pChild != 0; pChild = pChild->NextSibling()->ToElement())
+  for (pChild = pElement->FirstChildElement(); pChild != 0; pChild = pChild->NextSiblingElement())
   {
     if (ValueWithoutNamespace(pChild, "status"))
     {
-      return pChild->GetText();
+      return pChild->NoChildren() ? "" : pChild->FirstChild()->ValueStr();
     }
   }