summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/zmq_decoder.cpp2
-rw-r--r--src/zmq_encoder.cpp2
-rw-r--r--src/zmq_engine.cpp2
3 files changed, 4 insertions, 2 deletions
diff --git a/src/zmq_decoder.cpp b/src/zmq_decoder.cpp
index b461234..e51d802 100644
--- a/src/zmq_decoder.cpp
+++ b/src/zmq_decoder.cpp
@@ -70,7 +70,7 @@ bool zmq::zmq_decoder_t::message_ready ()
{
// Message is completely read. Push it further and start reading
// new message.
- if (!destination->write (&in_progress))
+ if (!destination || !destination->write (&in_progress))
return false;
next_step (tmpbuf, 1, &zmq_decoder_t::one_byte_size_ready);
diff --git a/src/zmq_encoder.cpp b/src/zmq_encoder.cpp
index 55e1a83..44b919b 100644
--- a/src/zmq_encoder.cpp
+++ b/src/zmq_encoder.cpp
@@ -54,7 +54,7 @@ bool zmq::zmq_encoder_t::message_ready ()
// Note that new state is set only if write is successful. That way
// unsuccessful write will cause retry on the next state machine
// invocation.
- if (!source->read (&in_progress))
+ if (!source || !source->read (&in_progress))
return false;
size_t size = zmq_msg_size (&in_progress);
diff --git a/src/zmq_engine.cpp b/src/zmq_engine.cpp
index 298dd57..3ed9ba5 100644
--- a/src/zmq_engine.cpp
+++ b/src/zmq_engine.cpp
@@ -66,6 +66,8 @@ void zmq::zmq_engine_t::plug (i_inout *inout_)
void zmq::zmq_engine_t::unplug ()
{
rm_fd (handle);
+ encoder.set_inout (NULL);
+ decoder.set_inout (NULL);
inout = NULL;
}