Merge pull request #1540 from djelenc/fix_failing_tests

Fixes failing tests regarding XPUB sockets.
This commit is contained in:
Richard Newton 2015-08-20 14:44:45 +01:00
commit 6aa5c20b3d

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 ();