diff --git a/frameworks/native/backup_ext/src/ext_backup_ani_error.cpp b/frameworks/native/backup_ext/src/ext_backup_ani_error.cpp index bd72c18a916cb9aab3eddfeee313a0403ebb0746..f49f3557ec871ea42b02c99ef315b689caaa5798 100644 --- a/frameworks/native/backup_ext/src/ext_backup_ani_error.cpp +++ b/frameworks/native/backup_ext/src/ext_backup_ani_error.cpp @@ -23,6 +23,10 @@ void AniError::ThrowBusinessError(ani_env *env, errorCode errCode, const std::st static const char *errorClsName = "L@ohos/base/BusinessError;"; HILOGD("Begin ThrowBusinessError."); + if (env == nullptr) { + HILOGE("env is nullptr"); + return; + } ani_class cls {}; if (ANI_OK != env->FindClass(errorClsName, &cls)) { HILOGE("find class BusinessError %{public}s failed", errorClsName);