aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2017-05-18 23:37:49 +0000
committerbloodstalker <thabogre@gmail.com>2017-05-18 23:37:49 +0000
commit2de9456c84d1fb5a7e779a49c370946f1aabb2c5 (patch)
tree523449080094ab1efae3e784bfd136b0780bdf3a
parentadded some comments (diff)
downloadmutator-2de9456c84d1fb5a7e779a49c370946f1aabb2c5.tar.gz
mutator-2de9456c84d1fb5a7e779a49c370946f1aabb2c5.zip
fixed a tinyxml2 assert being thrown when the xml report ended up being empty
Diffstat (limited to '')
-rw-r--r--mutator_report.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/mutator_report.cpp b/mutator_report.cpp
index e61cb5d..0eef3ca 100644
--- a/mutator_report.cpp
+++ b/mutator_report.cpp
@@ -47,6 +47,11 @@ XMLReport::XMLReport()
#endif
}
+XMLReport::~XMLReport()
+{
+ XMLReportDoc.InsertEndChild(RootPointer);
+}
+
void XMLReport::XMLCreateReport()
{
XMLReportDoc.InsertFirstChild(RootPointer);
@@ -138,13 +143,25 @@ void XMLReport::XMLAddNode(unsigned Line, unsigned Column, std::string FileName,
RootPointer->InsertEndChild(MisraElement);
}
+bool XMLReport::isReportEmpty(void)
+{
+ return false;
+}
+
void XMLReport::SaveReport(void)
{
+ if(this->isReportEmpty())
+ {
+ return void();
+ }
+
+ XMLReportDoc.InsertEndChild(RootPointer);
+
XMLError XMLErrorResult = XMLReportDoc.SaveFile("./test/misrareport.xml");
if (XMLErrorResult != XML_SUCCESS)
{
- std::cout << "could not write xml misra report." << std::endl;
+ std::cerr << "could not write xml misra report.\n";
}
}
/***************************************************End of XMLReport**************************************************/