From de64c679512aa0f6df8c75f7e556b54bc889c205 Mon Sep 17 00:00:00 2001 From: dong-bosi123 Date: Thu, 4 Sep 2025 19:55:40 +0800 Subject: [PATCH] fix the code alarm Signed-off-by: dong-bosi123 --- .../innerkits/unwinder/src/utils/dfx_offline_parser.cpp | 4 ++-- tools/dump_catcher/dump_catcher.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/innerkits/unwinder/src/utils/dfx_offline_parser.cpp b/interfaces/innerkits/unwinder/src/utils/dfx_offline_parser.cpp index 9cc372f98..f8b90cb93 100644 --- a/interfaces/innerkits/unwinder/src/utils/dfx_offline_parser.cpp +++ b/interfaces/innerkits/unwinder/src/utils/dfx_offline_parser.cpp @@ -147,7 +147,7 @@ bool DfxOfflineParser::ParseJsSymbol(DfxFrame& frame) std::string DfxOfflineParser::GetBundlePath(const std::string& originPath) const { - if (originPath.find(SANDBOX_PATH_PREFIX) != 0 || bundleName_.empty()) { + if (!StartsWith(originPath, SANDBOX_PATH_PREFIX) || bundleName_.empty()) { return originPath; } return BUNDLE_PATH_PREFIX + bundleName_ + "/" + originPath.substr(std::strlen(SANDBOX_PATH_PREFIX)); @@ -162,7 +162,7 @@ std::shared_ptr DfxOfflineParser::GetElfForFrame(const DfxFrame& frame) auto it = std::find_if(maps.begin(), maps.end(), [&](const std::shared_ptr& map) { return map->name == frame.mapName; }); - if (it != maps.end()) { + if (it != maps.end() && *it) { return (*it)->elf; } RegularElfFactory factory(GetBundlePath(frame.mapName)); diff --git a/tools/dump_catcher/dump_catcher.cpp b/tools/dump_catcher/dump_catcher.cpp index 910000fae..bb7df7353 100644 --- a/tools/dump_catcher/dump_catcher.cpp +++ b/tools/dump_catcher/dump_catcher.cpp @@ -35,7 +35,7 @@ namespace OHOS { namespace HiviewDFX { namespace { -constexpr int WAIT_GET_KERNEL_STACK_TIMEOUT = 1000; // 1000 : time out 1000 ms +constexpr int WAIT_GET_KERNEL_STACK_TIMEOUT = 1000; #ifndef is_ohos_lite sptr GetBundleManager() -- Gitee