diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp index 277d838913fc8595cb90077a17baae218f106e12..301d7fa09f341c761debc73c082dfec15724ef9c 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp @@ -1564,7 +1564,10 @@ void AniWindow::Resize(ani_env* env, ani_int width, ani_int height) AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); return; } - + if (width <= 0 || height <= 0) { + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); + return; + } const uint32_t w = static_cast(width); const uint32_t h = static_cast(height); const WMError ret = windowToken_->Resize(w, h);