diff --git a/src/cpp/rtps/history/TopicPayloadPool.cpp b/src/cpp/rtps/history/TopicPayloadPool.cpp index 014d57f80f4..1e565024269 100644 --- a/src/cpp/rtps/history/TopicPayloadPool.cpp +++ b/src/cpp/rtps/history/TopicPayloadPool.cpp @@ -253,7 +253,11 @@ void TopicPayloadPool::reserve ( for (size_t i = all_payloads_.size(); i < min_num_payloads; ++i) { PayloadNode* payload = do_allocate(size); - free_payloads_.push_back(payload); + + if(payload != nullptr) + { + free_payloads_.push_back(payload); + } } }