cache number invalid add

Signed-off-by: w30052974 <wangyifan94@huawei.com>
This commit is contained in:
w30052974 2024-11-30 09:52:11 +08:00
parent eab4cb80d1
commit cf1eba8a1d

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;
}