mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-26 16:52:10 +00:00
!48959 修复navigationRoute空指针
Merge pull request !48959 from tsj_2020/request
This commit is contained in:
commit
c22affbba4
@ -846,15 +846,31 @@ int32_t JSNavigationStack::LoadDestination(const std::string& name, const JSRef<
|
||||
}
|
||||
// deal route config and execute route config builder
|
||||
auto container = Container::Current();
|
||||
CHECK_NULL_RETURN(container, ERROR_CODE_INTERNAL_ERROR);
|
||||
auto navigationRoute = container->GetNavigationRoute();
|
||||
if (!navigationRoute->HasLoaded(name)) {
|
||||
int32_t res = navigationRoute->LoadPage(name);
|
||||
if (res != 0) {
|
||||
TAG_LOGE(AceLogTag::ACE_NAVIGATION, "load page failed: %{public}s", name.c_str());
|
||||
return navDestBuilderFunc_->IsEmpty() ? ERROR_CODE_BUILDER_FUNCTION_NOT_REGISTERED
|
||||
: ERROR_CODE_DESTINATION_NOT_FOUND;
|
||||
}
|
||||
if (!navigationRoute) {
|
||||
TAG_LOGI(AceLogTag::ACE_NAVIGATION, "navigation route is invalid");
|
||||
return ERROR_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
if (!navigationRoute->HasLoaded(name) && navigationRoute->LoadPage(name) != 0) {
|
||||
TAG_LOGE(AceLogTag::ACE_NAVIGATION, "load page failed: %{public}s", name.c_str());
|
||||
return navDestBuilderFunc_->IsEmpty() ? ERROR_CODE_BUILDER_FUNCTION_NOT_REGISTERED
|
||||
: ERROR_CODE_DESTINATION_NOT_FOUND;
|
||||
}
|
||||
int32_t result = ExecuteBuilderByConfig(name, customNode, param);
|
||||
if (result != ERROR_CODE_NO_ERROR) {
|
||||
return result;
|
||||
}
|
||||
node = NG::ViewStackProcessor::GetInstance()->Finish();
|
||||
if (!GetNavDestinationNodeInUINode(node, desNode)) {
|
||||
return ERROR_CODE_DESTINATION_NOT_FOUND;
|
||||
}
|
||||
return ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t JSNavigationStack::ExecuteBuilderByConfig(const std::string& name,
|
||||
const WeakPtr<NG::UINode>& customNode, const JSRef<JSVal>& param)
|
||||
{
|
||||
auto parentCustomNode = AceType::DynamicCast<NG::CustomNode>(customNode.Upgrade());
|
||||
CHECK_NULL_RETURN(parentCustomNode, ERROR_CODE_INTERNAL_ERROR);
|
||||
auto thisObjTmp = parentCustomNode->FireThisFunc();
|
||||
@ -883,10 +899,6 @@ int32_t JSNavigationStack::LoadDestination(const std::string& name, const JSRef<
|
||||
}
|
||||
auto builder = JSRef<JSFunc>::Cast(builderProp);
|
||||
builder->Call(thisObj, number, params);
|
||||
node = NG::ViewStackProcessor::GetInstance()->Finish();
|
||||
if (!GetNavDestinationNodeInUINode(node, desNode)) {
|
||||
return ERROR_CODE_DESTINATION_NOT_FOUND;
|
||||
}
|
||||
return ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,8 @@ private:
|
||||
|
||||
bool GetNeedUpdatePathInfo(int32_t index);
|
||||
void SetNeedUpdatePathInfo(int32_t index, bool need);
|
||||
int32_t ExecuteBuilderByConfig(const std::string& name,
|
||||
const WeakPtr<NG::UINode>& customNode, const JSRef<JSVal>& param);
|
||||
|
||||
JSRef<JSArray> GetPathArray();
|
||||
JSRef<JSObject> GetPathInfo(int32_t index);
|
||||
|
@ -298,8 +298,10 @@ bool StageManager::PopPage(const RefPtr<FrameNode>& inPage, bool needShowNext, b
|
||||
}
|
||||
return true;
|
||||
}
|
||||
stageNode_->RemoveChild(pageNode);
|
||||
pageNode->SetChildrenInDestroying();
|
||||
if (pageNode) {
|
||||
stageNode_->RemoveChild(pageNode);
|
||||
pageNode->SetChildrenInDestroying();
|
||||
}
|
||||
stageNode_->RebuildRenderContextTree();
|
||||
pipeline->RequestFrame();
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user