Commit 63b6051c authored by Dominik Charousset's avatar Dominik Charousset

fixed issue with serialization of empty any tuples

parent e9c0ca27
...@@ -287,14 +287,19 @@ void deserialize_impl(channel& ptrref, deserializer* source) { ...@@ -287,14 +287,19 @@ void deserialize_impl(channel& ptrref, deserializer* source) {
} }
void serialize_impl(const any_tuple& tup, serializer* sink) { void serialize_impl(const any_tuple& tup, serializer* sink) {
auto tname = tup.tuple_type_names(); std::string dynamic_name; // used if tup holds an object_array
auto uti = get_uniform_type_info_map() // ttn can be nullptr even if tuple is not empty (in case of object_array)
->by_uniform_name(tname const std::string* ttn = tup.empty() ? nullptr : tup.tuple_type_names();
? *tname const char* tname = ttn ? ttn->data() : (tup.empty() ? "@<>" : nullptr);
: detail::get_tuple_type_names(*tup.vals())); if (!tname) {
// tuple is not empty, i.e., we are dealing with an object array
dynamic_name = detail::get_tuple_type_names(*tup.vals());
tname = dynamic_name.c_str();
}
auto uti = get_uniform_type_info_map()->by_uniform_name(tname);
if (uti == nullptr) { if (uti == nullptr) {
std::string err = "could not get uniform type info for \""; std::string err = "could not get uniform type info for \"";
err += tname ? *tname : detail::get_tuple_type_names(*tup.vals()); err += tname;
err += "\""; err += "\"";
CPPA_LOGF_ERROR(err); CPPA_LOGF_ERROR(err);
throw std::runtime_error(err); throw std::runtime_error(err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment