File tree Expand file tree Collapse file tree
src/cpp/fastdds/xtypes/serializers/json Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -582,6 +582,13 @@ ReturnCode_t json_serialize_enum_member(
582582 enum_type = traits<DynamicType>::narrow<DynamicTypeImpl>(enum_desc->type ())->resolve_alias_enclosed_type ();
583583 }
584584
585+ if (nullptr == enum_type)
586+ {
587+ EPROSIMA_LOG_ERROR (XTYPES_UTILS ,
588+ " Error encountered while serializing TK_ENUM member to JSON: null enum type." );
589+ return RETCODE_BAD_PARAMETER ;
590+ }
591+
585592 // Get value depending on the enclosing type
586593 assert (enum_type->get_kind () == TK_ENUM );
587594 TypeKind enclosing_kind = traits<DynamicType>::narrow<DynamicTypeImpl>(enum_type->get_all_members_by_index ().at (
Original file line number Diff line number Diff line change @@ -677,6 +677,13 @@ ReturnCode_t json_deserialize_enum_member(
677677 enum_type = traits<DynamicType>::narrow<DynamicTypeImpl>(enum_desc->type ())->resolve_alias_enclosed_type ();
678678 }
679679
680+ if (nullptr == enum_type)
681+ {
682+ EPROSIMA_LOG_ERROR (XTYPES_UTILS ,
683+ " Error encountered while deserializing TK_ENUM member from JSON: null enum type." );
684+ return RETCODE_BAD_PARAMETER ;
685+ }
686+
680687 // Get enclosing type kind to parse the value accordingly, and later user the appropriate setter
681688 assert (enum_type->get_kind () == TK_ENUM );
682689 TypeKind enclosing_kind = traits<DynamicType>::narrow<DynamicTypeImpl>(enum_type->get_all_members_by_index ().at (
You can’t perform that action at this time.
0 commit comments