Fixes failing tests regarding XPUB sockets.

Fixes tests that were introduced in a previous pull request. See
https://github.com/zeromq/libzmq/pull/1539#issuecomment-132968987
This commit is contained in:
David Jelenc 2015-08-20 15:32:23 +02:00
parent 391bc12d17
commit 1240d7ac83

View File

@ -244,7 +244,12 @@ int zmq::xpub_t::xrecv (msg_t *msg_)
memcpy (msg_->data (),
pending_data.front ().data (),
pending_data.front ().size ());
msg_->set_metadata (pending_metadata.front ());
// set metadata only if there is some
if (metadata_t* metadata = pending_metadata.front ()) {
msg_->set_metadata (metadata);
}
msg_->set_flags (pending_flags.front ());
pending_data.pop_front ();
pending_metadata.pop_front ();