summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Doukoudakis <thanos.doukoudakis@isode.com>2017-05-11 15:41:20 (GMT)
committerKevin Smith <kevin.smith@isode.com>2017-05-15 09:27:12 (GMT)
commit24baaf8ad66354c17a6d6ba4438e95d6798564a8 (patch)
tree884f0c021f4cb7bd0bb473f5d6f68bc17f744ccd /Swiften/Client
parentad7fcc8ef11cbe07d48354a5d45b09e4faa9b24d (diff)
downloadswift-24baaf8ad66354c17a6d6ba4438e95d6798564a8.zip
swift-24baaf8ad66354c17a6d6ba4438e95d6798564a8.tar.bz2
Add pointer checks in some CoreClient members.
This patch adds some checks in the CoreClient class to avoid accessing stanza and session channels to send data when they are not available. The Sluift lua wrapper functions will throw an exception in these cases. Test-Information All unit test pass. Timlx: Test Suite ‘basic’: All tests Pass. Test Suite ‘fmuc’: All tests except FmucChain Pass (Not related with the changes) Change-Id: I3d5894b3cfdafd0ea28c0fb33b6db8588f2a5c8f
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/CoreClient.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index 3c7902e..1de1d61 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -390,6 +390,10 @@ void CoreClient::sendPresence(std::shared_ptr<Presence> presence) {
}
void CoreClient::sendData(const std::string& data) {
+ if (!sessionStream_) {
+ SWIFT_LOG(warning) << "Client: Trying to send data while disconnected." << std::endl;
+ return;
+ }
sessionStream_->writeData(data);
}