From 9b8637c45a63f9ec3631a603cea5180a010b26b6 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Fri, 19 Nov 2021 14:21:22 +0900 Subject: [PATCH] Fix static analysis issues Change-Id: I65a4b531d37378b6e4e113f24718442c781d2a07 Signed-off-by: Sangyoon Jang --- idlc/gen_cion/cpp_cion_gen_base.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/idlc/gen_cion/cpp_cion_gen_base.cc b/idlc/gen_cion/cpp_cion_gen_base.cc index 407082a..ebba91f 100644 --- a/idlc/gen_cion/cpp_cion_gen_base.cc +++ b/idlc/gen_cion/cpp_cion_gen_base.cc @@ -368,8 +368,11 @@ void CppCionGeneratorBase::GenListSerializer(std::ofstream& stream, << NLine(1); stream << Tab(1) << "for (const auto& i : c) "; GenBrace(stream, TAB_SIZE, [&]() { - auto& mt = *type.GetMetaType(); - stream << AddIndent(TAB_SIZE * 2, ConvertTypeToSerializer(mt, "i", "h")); + if (type.GetMetaType() != nullptr) { + auto& mt = *type.GetMetaType(); + stream << AddIndent(TAB_SIZE * 2, + ConvertTypeToSerializer(mt, "i", "h")); + } }, false); stream << Tab(1) << "return h;" << NLine(1); }, false); @@ -383,10 +386,12 @@ void CppCionGeneratorBase::GenListSerializer(std::ofstream& stream, << "rpc_port_parcel_read_array_count(h, &l);" << NLine(1); stream << Tab(1) << "for (int i = 0; i < l; i++) "; GenBrace(stream, TAB_SIZE, [&]() { - auto& mt = *type.GetMetaType(); - stream << AddIndent(TAB_SIZE * 2, - ConvertTypeToDeserializer(mt, "v", "h", true)); - stream << Tab(2) << "c.push_back(std::move(v));" << NLine(1); + if (type.GetMetaType() != nullptr) { + auto& mt = *type.GetMetaType(); + stream << AddIndent(TAB_SIZE * 2, + ConvertTypeToDeserializer(mt, "v", "h", true)); + stream << Tab(2) << "c.push_back(std::move(v));" << NLine(1); + } }, false); stream << Tab(1) << "return h;" << NLine(1); }, false); -- 2.7.4