MinimizeAll传入非法返回值时报错

Signed-off-by: chenqinxin <chenqinxin1@huawei.com>
Change-Id: Id401aba426429cefa193fcd37683c71902887f8b
This commit is contained in:
chenqinxin
2022-03-08 10:43:12 +08:00
parent e1847dc42b
commit 7fb82a5018
@@ -16,6 +16,7 @@
#include <ability.h>
#include <cinttypes>
#include "ability_context.h"
#include "display_manager.h"
#include "dm_common.h"
#include "js_window.h"
#include "js_window_utils.h"
@@ -323,7 +324,13 @@ NativeValue* JsWindowManager::OnMinimizeAll(NativeEngine& engine, NativeCallback
WLOGFE("Failed to convert parameter to displayId");
errCode = WMError::WM_ERROR_INVALID_PARAM;
}
WLOGFI("displayId %{public}" PRIu64"", static_cast<uint64_t>(displayId));
if (displayId < 0 ||
SingletonContainer::Get<DisplayManager>().GetDisplayById(static_cast<uint64_t>(displayId)) == nullptr) {
WLOGFE("displayId is invalid");
errCode = WMError::WM_ERROR_INVALID_PARAM;
} else {
WLOGFI("displayId %{public}" PRIu64"", static_cast<uint64_t>(displayId));
}
AsyncTask::CompleteCallback complete =
[=](NativeEngine& engine, AsyncTask& task, int32_t status) {
if (errCode != WMError::WM_OK) {