Zmq: let GetData of an empty message return nullptr

This commit is contained in:
Alexey Rybalchenko
2020-06-04 23:27:11 +02:00
parent 36d4f3c937
commit 79ca436b74
2 changed files with 45 additions and 2 deletions

View File

@@ -155,9 +155,17 @@ class Message final : public fair::mq::Message
void* GetData() const override
{
if (!fViewMsg) {
return zmq_msg_data(fMsg.get());
if (zmq_msg_size(fMsg.get()) > 0) {
return zmq_msg_data(fMsg.get());
} else {
return nullptr;
}
} else {
return zmq_msg_data(fViewMsg.get());
if (zmq_msg_size(fViewMsg.get()) > 0) {
return zmq_msg_data(fViewMsg.get());
} else {
return nullptr;
}
}
}