summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/TLS')
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
index cd6b6bc..0805917 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
@@ -121,6 +121,12 @@ void OpenSSLContext::ensureLibraryInitialized() {
void OpenSSLContext::connect() {
handle_ = SSL_new(context_);
+ if (handle_ == nullptr) {
+ state_ = Error;
+ onError(std::make_shared<TLSError>());
+ return;
+ }
+
// Ownership of BIOs is ransferred
readBIO_ = BIO_new(BIO_s_mem());
writeBIO_ = BIO_new(BIO_s_mem());