From 1db708d4d6fd4b86e9497e1f9a81c4817b1671e9 Mon Sep 17 00:00:00 2001 From: JesusPoderoso Date: Thu, 25 Apr 2024 15:08:14 +0200 Subject: [PATCH] Refs #20742: Fix unset datarepresentation case Signed-off-by: JesusPoderoso --- src/cpp/fastdds/subscriber/DataReaderImpl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cpp/fastdds/subscriber/DataReaderImpl.cpp b/src/cpp/fastdds/subscriber/DataReaderImpl.cpp index fd644fc6ba3..36929bc81ed 100644 --- a/src/cpp/fastdds/subscriber/DataReaderImpl.cpp +++ b/src/cpp/fastdds/subscriber/DataReaderImpl.cpp @@ -1787,10 +1787,14 @@ DataReaderListener* DataReaderImpl::get_listener_for( std::shared_ptr DataReaderImpl::get_payload_pool() { // Check whether DataReader's type is plain in all its data representations - bool is_plain = true; - for (auto data_representation : qos_.type_consistency().representation.m_value) + bool is_plain = type_->is_plain(); + if (qos_.type_consistency().representation.m_value.size() > 0) { - is_plain = is_plain && type_->is_plain(data_representation); + is_plain = true; + for (auto data_representation : qos_.type_consistency().representation.m_value) + { + is_plain = is_plain && type_->is_plain(data_representation); + } } // When the user requested PREALLOCATED_WITH_REALLOC, but we know the type cannot