From ec9ccb2eb0003d305fb501bf13dfe82f5110e610 Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Mon, 28 Jul 2025 20:12:12 +0800 Subject: [PATCH] fix setFont and setLanguage empty bug Signed-off-by: zhangzezhong --- .../ets/ani/ani_common/src/ets_application_context_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/ets/ani/ani_common/src/ets_application_context_utils.cpp b/frameworks/ets/ani/ani_common/src/ets_application_context_utils.cpp index 918e4811e90..8a74682956f 100644 --- a/frameworks/ets/ani/ani_common/src/ets_application_context_utils.cpp +++ b/frameworks/ets/ani/ani_common/src/ets_application_context_utils.cpp @@ -285,7 +285,7 @@ void EtsApplicationContextUtils::OnSetFont(ani_env *env, ani_object aniObj, ani_ return; } std::string stdFont = ""; - if (!AppExecFwk::GetStdString(env, font, stdFont)) { + if (!AppExecFwk::GetStdString(env, font, stdFont) || stdFont.empty()) { TAG_LOGE(AAFwkTag::APPKIT, "Parse font failed"); EtsErrorUtil::ThrowInvalidParamError(env, "Parse param font failed, font must be string."); return; @@ -327,7 +327,7 @@ void EtsApplicationContextUtils::OnSetLanguage(ani_env *env, ani_object aniObj, return; } std::string stdLanguage = ""; - if (!AppExecFwk::GetStdString(env, language, stdLanguage)) { + if (!AppExecFwk::GetStdString(env, language, stdLanguage) || stdLanguage.empty()) { TAG_LOGE(AAFwkTag::APPKIT, "Parse language failed"); EtsErrorUtil::ThrowInvalidParamError(env, "Parse param language failed, language must be string."); return; -- Gitee