summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Doukoudakis <thanos.doukoudakis@isode.com>2017-06-13 14:41:00 (GMT)
committerKevin Smith <kevin.smith@isode.com>2017-06-22 11:48:32 (GMT)
commitb634796ad03d009ec9ef593f6a881a964e7f0d31 (patch)
tree47fceae6c96f56168568c90813ae8479d4cd6572 /Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
parent2416d8818afe449dc93b9f8a4e0e3ecaeba0509d (diff)
downloadswift-b634796ad03d009ec9ef593f6a881a964e7f0d31.zip
swift-b634796ad03d009ec9ef593f6a881a964e7f0d31.tar.bz2
Handle badly-formed labels catalogue
Updated the code to ignore labels that belong to a catalog item that is malformed and not added as a valid item. Test-Information: Added unit tests for badly formed catalog items and labels. Tested on Windows 10 (Qt 5.7.1) and Ubuntu 16.04 (Qt 5.5.1) Change-Id: I11fbd3b54faa3ee225a08a87ad8ed59977b7ff20
Diffstat (limited to 'Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
index 1897080..58b0af0 100644
--- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
+++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
@@ -34,7 +34,7 @@ void SecurityLabelsCatalogParser::handleStartElement(const std::string& element,
currentItem_->setSelector(attributes.getAttribute("selector"));
currentItem_->setIsDefault(attributes.getBoolAttribute("default", false));
}
- else if (level_ == LabelLevel) {
+ else if (level_ == LabelLevel && currentItem_) {
assert(!labelParser_);
if (labelParserFactory_->canParse(element, ns, attributes)) {
labelParser_ = dynamic_cast<SecurityLabelParser*>(labelParserFactory_->createPayloadParser());