From 2afeb542c859195d06997f846d314b582ae2b366 Mon Sep 17 00:00:00 2001 From: dingxiaochen Date: Thu, 16 Mar 2023 22:19:06 +0800 Subject: [PATCH] fix cppcheck. Signed-off-by: dingxiaochen --- common/src/parser_util.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/src/parser_util.cpp b/common/src/parser_util.cpp index d1f4202..665ddc9 100755 --- a/common/src/parser_util.cpp +++ b/common/src/parser_util.cpp @@ -75,6 +75,10 @@ int ParserUtil::ParserPdpProfileJson(std::vector &vec) DATA_STORAGE_LOGE("ParserUtil::ParserPdpProfileJson LoaderJsonFile is fail!\n"); return ret; } + if (content == nullptr) { + DATA_STORAGE_LOGE("ParserUtil::content is nullptr!"); + return static_cast(LoadProFileErrorType::FILE_PARSER_ERROR); + } const int contentLength = strlen(content); const std::string rawJson(content); free(content);