summaryrefslogtreecommitdiff
path: root/src/hos_client.cpp
diff options
context:
space:
mode:
author彭宣正 <[email protected]>2021-03-15 17:26:24 +0800
committer彭宣正 <[email protected]>2021-03-15 17:26:24 +0800
commit34053d039d46463e579c378c2efba44df76cc11d (patch)
treec9daf0913f6721964dec6bbdc36e46f0959822a7 /src/hos_client.cpp
parente3b908194c5eb0ff043413054f336fee52b7d60a (diff)
🐞fix(hos_client.cpp): 修复缺少的判空导致的段错误
Diffstat (limited to 'src/hos_client.cpp')
-rw-r--r--src/hos_client.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/hos_client.cpp b/src/hos_client.cpp
index e20c7230..99759d93 100644
--- a/src/hos_client.cpp
+++ b/src/hos_client.cpp
@@ -156,6 +156,10 @@ static void PutObjectAsyncFinished(const Aws::S3::S3Client* S3Client,
void hos_set_cache_size(hos_client_handle client, size_t cache_size)
{
+ if (client == NULL)
+ {
+ return;
+ }
client->cache_size = cache_size;
hos_cache = (size_t *)calloc(client->thread_sum, sizeof(size_t));
return ;
@@ -163,12 +167,20 @@ void hos_set_cache_size(hos_client_handle client, size_t cache_size)
void hos_set_cache_count(hos_client_handle client, size_t cache_count)
{
+ if (client == NULL)
+ {
+ return;
+ }
client->cache_count = cache_count;
return ;
}
void hos_set_thread_sum(hos_client_handle client, size_t thread_sum)
{
+ if (client == NULL)
+ {
+ return;
+ }
client->thread_sum = thread_sum;
for (size_t i = 0; i < thread_sum; i++)
{