Skip to content

Commit 43cc32e

Browse files
committed
Fixing failing tests on rmw_fastrtps_dynamic_cpp.
1 parent f6cb095 commit 43cc32e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,13 @@ inline void deserialize_field<std::string>(
641641
}
642642
deser >> *static_cast<std::string *>(field);
643643
} else if (member->array_size_ && !member->is_upper_bound_) {
644-
deser.deserializeArray(static_cast<std::string *>(field), member->array_size_);
644+
std::string * array = static_cast<std::string *>(field);
645+
if (call_new) {
646+
for (size_t i = 0; i < member->array_size_; ++i) {
647+
new(&array[i]) std::string();
648+
}
649+
}
650+
deser.deserializeArray(array, member->array_size_);
645651
} else {
646652
auto & vector = *reinterpret_cast<std::vector<std::string> *>(field);
647653
if (call_new) {

0 commit comments

Comments
 (0)