1
0
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:
Sébastien Helleu
2019-06-15 17:21:06 +02:00
parent 95cbf3a48b
commit 866a29c7e6
2 changed files with 7 additions and 1 deletions
+3
View File
@@ -3616,6 +3616,9 @@ string_shared_get (const char *string)
char *key;
int length;
if (!string)
return NULL;
if (!string_hashtable_shared)
{
/*
+4 -1
View File
@@ -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);