diff --git a/src/cpp/rtps/messages/RTPSMessageGroup.cpp b/src/cpp/rtps/messages/RTPSMessageGroup.cpp index e238f65b76a..4b81a6d5e5f 100644 --- a/src/cpp/rtps/messages/RTPSMessageGroup.cpp +++ b/src/cpp/rtps/messages/RTPSMessageGroup.cpp @@ -356,13 +356,13 @@ void RTPSMessageGroup::send() { if (endpoint_ && sender_) { - CDRMessage_t* msgToSend = header_msg_; if (header_msg_->length > RTPSMESSAGE_HEADER_SIZE) { std::lock_guard lock(*sender_); #if HAVE_SECURITY + CDRMessage_t* msgToSend = header_msg_; // TODO(Ricardo) Control message size if it will be encrypted. if (participant_->security_attributes().is_rtps_protected && endpoint_->supports_rtps_protection()) {