From 1240d7ac834ea43ea352655ee8ed5cb3cba896e7 Mon Sep 17 00:00:00 2001 From: David Jelenc Date: Thu, 20 Aug 2015 15:32:23 +0200 Subject: [PATCH] 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 --- src/xpub.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/xpub.cpp b/src/xpub.cpp index b9e5769a..b98a7ca2 100644 --- a/src/xpub.cpp +++ b/src/xpub.cpp @@ -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 ();