diff --git a/frameworks/ets/ani/ani_common/src/ani_common_util.cpp b/frameworks/ets/ani/ani_common/src/ani_common_util.cpp index 86cf40abb8c8d240592ed244dabf27638525422a..1a76532c4dbb21f98aac955d545dbd73d57ac239 100644 --- a/frameworks/ets/ani/ani_common/src/ani_common_util.cpp +++ b/frameworks/ets/ani/ani_common/src/ani_common_util.cpp @@ -859,9 +859,9 @@ bool SetProcessInformation(ani_env *env, ani_object object, const AppExecFwk::Ru TAG_LOGE(AAFwkTag::ANI, "bundleType failed status:%{public}d", status); return false; } - status = env->Object_SetPropertyByName_Ref(object, "appCloneIndex", - CreateInt(env, processInfo.appCloneIndex)); - if (status != ANI_OK) { + if (processInfo.appCloneIndex != -1 && + (status = env->Object_SetPropertyByName_Ref( + object, "appCloneIndex", CreateInt(env, processInfo.appCloneIndex))) != ANI_OK) { TAG_LOGE(AAFwkTag::ANI, "appCloneIndex failed status:%{public}d", status); return false; }