diff --git a/adapter/ohos/osal/page_url_checker_ohos.cpp b/adapter/ohos/osal/page_url_checker_ohos.cpp index 88518bf0eab3c6adcacae1d3705aa7f5f72aa014..69c9027beb0bdfc920e7307e92850e66d44d1eac 100644 --- a/adapter/ohos/osal/page_url_checker_ohos.cpp +++ b/adapter/ohos/osal/page_url_checker_ohos.cpp @@ -203,10 +203,11 @@ void PageUrlCheckerOhos::LoadPageUrl(const std::string& url, const std::function if (appInfo) { std::vector moduleList = appInfo->moduleInfos; bool isInstalled = false; - for (const auto& module : moduleList) { - if (module.moduleName == moduleName) { - isInstalled = true; - } + auto res = std::any_of(moduleList.begin(), moduleList.end(), [moduleName](const auto &module) { + return module.moduleName == moduleName; + }); + if (res) { + isInstalled = true; } if (!isInstalled) { diff --git a/frameworks/bridge/declarative_frontend/ng/page_router_manager.cpp b/frameworks/bridge/declarative_frontend/ng/page_router_manager.cpp index 1a7f2d2c040581b708eecb66bc441837c7682f59..35c9d1608d92d9cd6ca52b7e98a54b2257c0b0c6 100644 --- a/frameworks/bridge/declarative_frontend/ng/page_router_manager.cpp +++ b/frameworks/bridge/declarative_frontend/ng/page_router_manager.cpp @@ -415,6 +415,9 @@ void PageRouterManager::PushOhmUrl(const RouterPageInfo& target, const std::stri { if (GetStackSize() >= MAX_ROUTER_STACK_SIZE) { LOGE("router stack size is larger than max size 32."); + if (errorCallback != nullptr) { + errorCallback("The pages are pushed too much.", Framework::ERROR_CODE_PAGE_STACK_FULL); + } return; } std::string url = target.url; @@ -487,6 +490,9 @@ void PageRouterManager::StartPush(const RouterPageInfo& target, const std::strin } if (GetStackSize() >= MAX_ROUTER_STACK_SIZE) { LOGE("router stack size is larger than max size 32."); + if (errorCallback != nullptr) { + errorCallback("The pages are pushed too much.", Framework::ERROR_CODE_PAGE_STACK_FULL); + } return; } std::string url = target.url;