From 7e36db07b113b7e68e1a3e46ff40c0d7cc823583 Mon Sep 17 00:00:00 2001 From: Vincent Tellier Date: Sun, 1 Jan 2017 17:54:17 +0100 Subject: [PATCH] Handshake events null pointer fix The mechanism is instanciated during the handshake itself, when and error happen before this, the error method shall work anyway. An error handling with a NULL mechanism means the handshake fail, so the handshake failure event is also raised in this case. --- src/stream_engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index b61a8ab0..878160b7 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -978,7 +978,7 @@ void zmq::stream_engine_t::error (error_reason_t reason) } zmq_assert (session); #ifdef ZMQ_BUILD_DRAFT_API - if(mechanism->status() == mechanism_t::handshaking) + if(mechanism == NULL || mechanism->status() == mechanism_t::handshaking) socket->event_handshake_failed(endpoint, (int) s); #endif socket->event_disconnected (endpoint, (int) s);