Skip to content

Commit f8d42bd

Browse files
authored
Removed warning (#187)
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
1 parent c10b3be commit f8d42bd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rmw_connextdds_common/src/common/rmw_type_support.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,12 @@ void RMW_Connext_MessageTypeSupport::type_info(
830830

831831
if (keyed) {
832832
key_callbacks = *callbacks->key_callbacks;
833-
key_serialized_size_max = key_callbacks.max_serialized_size_key(unbounded_key);
833+
if (key_callbacks.max_serialized_size_key(unbounded_key) < RTI_CDR_MAX_SERIALIZED_SIZE) {
834+
key_serialized_size_max = static_cast<uint32_t>(
835+
key_callbacks.max_serialized_size_key(unbounded_key));
836+
} else {
837+
throw std::runtime_error("unbounded_key is bigger than RTI_CDR_MAX_SERIALIZED_SIZE");
838+
}
834839
/* add encapsulation size to static serialized_size_max */
835840
if (!unbounded_key) {
836841
key_serialized_size_max +=

0 commit comments

Comments
 (0)