mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
core: check that string pointer is not NULL in function "string_shared_get"
This commit is contained in:
@@ -3616,6 +3616,9 @@ string_shared_get (const char *string)
|
||||
char *key;
|
||||
int length;
|
||||
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
if (!string_hashtable_shared)
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -1839,7 +1839,10 @@ TEST(CoreString, Shared)
|
||||
const char *str1, *str2, *str3;
|
||||
int count;
|
||||
|
||||
count = string_hashtable_shared->items_count;
|
||||
count = (string_hashtable_shared) ?
|
||||
string_hashtable_shared->items_count : 0;
|
||||
|
||||
POINTERS_EQUAL(NULL, string_shared_get (NULL));
|
||||
|
||||
str1 = string_shared_get ("this is a test");
|
||||
CHECK(str1);
|
||||
|
||||
Reference in New Issue
Block a user