summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-10-05 11:11:29 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-10-05 11:11:29 (GMT)
commit8159071adb232b68c2ce79479145fbcd04979245 (patch)
tree9282fc76499719c18fa9c9e892535d2f46030b43 /Swift/Controllers/Chat/ChatControllerBase.cpp
parent4c942cbb0b76383bfad10b3677a75a52f9193cf7 (diff)
downloadswift-8159071adb232b68c2ce79479145fbcd04979245.zip
swift-8159071adb232b68c2ce79479145fbcd04979245.tar.bz2
Don't crash with label item without a label
Diffstat (limited to 'Swift/Controllers/Chat/ChatControllerBase.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index 4bcb4c7..ecb9288 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -78,12 +78,9 @@ void ChatControllerBase::setOnline(bool online) {
void ChatControllerBase::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) {
if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::SecurityLabelsCatalogFeature)) {
- //chatWindow_->setSecurityLabelsEnabled(true);
- //chatWindow_->setSecurityLabelsError();
GetSecurityLabelsCatalogRequest::ref request = GetSecurityLabelsCatalogRequest::create(JID(toJID_.toBare()), iqRouter_);
request->onResponse.connect(boost::bind(&ChatControllerBase::handleSecurityLabelsCatalogResponse, this, _1, _2));
request->send();
- //labelsEnabled_ = true;
} else {
chatWindow_->setSecurityLabelsEnabled(false);
labelsEnabled_ = false;
@@ -114,7 +111,10 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool
message->setType(Swift::Message::Chat);
message->setBody(body);
if (labelsEnabled_) {
- message->addPayload(chatWindow_->getSelectedSecurityLabel().getLabel());
+ SecurityLabelsCatalog::Item labelItem = chatWindow_->getSelectedSecurityLabel();
+ if (labelItem.getLabel()) {
+ message->addPayload(labelItem.getLabel());
+ }
}
preSendMessageRequest(message);
if (useDelayForLatency_) {