summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-23 20:33:41 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-23 20:33:41 (GMT)
commitea951bec1c4b84b739a9f435e0d17dbb99e4d724 (patch)
tree3ee38326cc8903caf76fac3f37a911aa1f6ed250
parent2c1104c7d78b9ac9a5611345f64c7b7ce4a167d7 (diff)
downloadswift-contrib-ea951bec1c4b84b739a9f435e0d17dbb99e4d724.zip
swift-contrib-ea951bec1c4b84b739a9f435e0d17dbb99e4d724.tar.bz2
Test whether we have a session before sending stanzas.
-rw-r--r--Swiften/Client/Client.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index 874e23b..3962281 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -89,6 +89,10 @@ void Client::closeConnection() {
}
void Client::send(boost::shared_ptr<Stanza> stanza) {
+ if (!isAvailable()) {
+ std::cerr << "Warning: Client: Trying to send a stanza while disconnected." << std::endl;
+ return;
+ }
session_->sendElement(stanza);
}
@@ -189,6 +193,7 @@ void Client::handleSessionFinished(boost::shared_ptr<Error> error) {
}
void Client::handleNeedCredentials() {
+ assert(session_);
session_->sendCredentials(password_);
}