在判空后获取token值

Change-Id: I584b18341befb756b17372d168c73aef837f4b3f
Signed-off-by: zhengjiangliang <zhengjiangliang@huawei.com>
This commit is contained in:
zhengjiangliang
2022-07-27 11:17:06 +08:00
parent 8af87010bf
commit 84d02463fb
+3 -2
View File
@@ -670,12 +670,12 @@ WMError WindowRoot::SetWindowMode(sptr<WindowNode>& node, WindowMode dstMode)
WMError WindowRoot::DestroyWindow(uint32_t windowId, bool onlySelf)
{
auto node = GetWindowNode(windowId);
auto token = node->abilityToken_;
if (node == nullptr) {
WLOGFW("Window mode is destroyed or not created");
return WMError::WM_OK;
}
WMError res;
auto token = node->abilityToken_;
auto container = GetOrCreateWindowNodeContainer(node->GetDisplayId());
if (container != nullptr) {
UpdateFocusWindowWithWindowRemoved(node, container);
@@ -700,7 +700,8 @@ WMError WindowRoot::DestroyWindow(uint32_t windowId, bool onlySelf)
HandleKeepScreenOn(id, false);
DestroyWindowInner(node);
}
if ((node != nullptr) && (node->abilityToken_ != token) &&
if ((node != nullptr) && (node->GetWindowToken() != nullptr) &&
(node->abilityToken_ != token) &&
(node->GetWindowType() == WindowType::WINDOW_TYPE_DIALOG)) {
node->GetWindowToken()->NotifyDestroy();
}