summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-02 11:25:58 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-02 11:27:08 +0300
commit6753aca9ffa6a0569cf6cba2a47cda0e364f458c (patch)
tree9bdd9d6d1bbf9e3f3b7d0824ff7feb8d1891c96e /src
parentf53f11cffd16e9bfc84c22dd644906db34b44d60 (diff)
Jingle: fix for occasional crash
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/tinyxml2_utils.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/mir_core/src/tinyxml2_utils.cpp b/src/mir_core/src/tinyxml2_utils.cpp
index 087e9d0230..c7351f16dc 100644
--- a/src/mir_core/src/tinyxml2_utils.cpp
+++ b/src/mir_core/src/tinyxml2_utils.cpp
@@ -71,9 +71,10 @@ MIR_CORE_DLL(int) XmlGetChildInt(const TiXmlElement *hXml, const char *key)
MIR_CORE_DLL(const TiXmlElement*) XmlGetChildByTag(const TiXmlElement *hXml, const char *key, const char *attrName, const char *attrValue)
{
- for (auto *pChild : TiXmlFilter(hXml, key))
- if (pChild->Attribute(attrName, attrValue))
- return pChild;
+ if (hXml)
+ for (auto *pChild : TiXmlFilter(hXml, key))
+ if (pChild->Attribute(attrName, attrValue))
+ return pChild;
return nullptr;
}
@@ -81,9 +82,11 @@ MIR_CORE_DLL(const TiXmlElement*) XmlGetChildByTag(const TiXmlElement *hXml, con
MIR_CORE_DLL(int) XmlGetChildCount(const TiXmlElement *hXml)
{
int iCount = 0;
- for (auto *it : TiXmlEnum(hXml)) {
- UNREFERENCED_PARAMETER(it);
- iCount++;
- }
+ if (hXml)
+ for (auto *it : TiXmlEnum(hXml)) {
+ UNREFERENCED_PARAMETER(it);
+ iCount++;
+ }
+
return iCount;
}