!242 cache number invalid add

Merge pull request !242 from wangyifan/master
This commit is contained in:
openharmony_ci 2024-11-30 03:43:50 +00:00 committed by Gitee
commit ea42fc43ce
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -596,8 +596,8 @@ NNRT_API bool OH_NNModel_HasCache(const char *cacheDir, const char *modelName, u
return false;
}
if (fileNumber > FILE_NUMBER_MAX) {
LOGE("OH_NNModel_HasCache fileNumber is more than 100");
if (fileNumber <= 0 || fileNumber > FILE_NUMBER_MAX) {
LOGE("OH_NNModel_HasCache fileNumber is invalid or more than 100");
std::filesystem::remove_all(cacheInfoPath);
return false;
}