summaryrefslogtreecommitdiff
path: root/test/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-07-15 00:03:13 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-07-15 08:01:29 +0200
commit798d19c80853166042ce8a14edf4a25cd491d6aa (patch)
tree88ecc324115c0a1c8672b67dac8bbb7011c9dbe7 /test/source
parent717dc8e3575a18e1e18dc446031e6db4e60a873d (diff)
Fix UB calling operator<<(std::basic_ostream) with nullptr
This resulted in segfault instead of a useful test failure message. Was this way ever since 548b360c0e4693aac0cbdd2fcc1aab433fc54010, and before in 6e31cbb4eaea3c6600248ba59a22853acc1d6606 and 9791453283407a0a129a71767a290058ac759da2. Change-Id: I498d1c84a4eaf3e8180dedd67d1176cf6f8c1a60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118916 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'test/source')
-rw-r--r--test/source/xmltesttools.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 12aed37f18e0..f92c380d9bf8 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -247,8 +247,8 @@ void XmlTestTools::assertXPathNoAttribute(const xmlDocUniquePtr& pXmlDoc, const
CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
1, xmlXPathNodeSetGetLength(pXmlNodes));
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
- CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' unexpected '" + rAttribute + "' attribute").getStr(),
- static_cast<xmlChar*>(nullptr), xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())));
+ CPPUNIT_ASSERT_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' unexpected '" + rAttribute + "' attribute").getStr(),
+ !xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())));
xmlXPathFreeObject(pXmlObj);
}