Ticket #3703: fix potential NULL dereference.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-10-23 09:08:05 +03:00
parent 1aefd27a2a
commit eec71bccff

View File

@ -346,12 +346,12 @@ mc_search_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str
{ {
GString *ret; GString *ret;
if (replace_str == NULL || replace_str->len == 0)
return g_string_new ("");
if (lc_mc_search == NULL) if (lc_mc_search == NULL)
return g_string_new_len (replace_str->str, replace_str->len); return g_string_new_len (replace_str->str, replace_str->len);
if (replace_str == NULL || replace_str->str == NULL || replace_str->len == 0)
return g_string_new ("");
switch (lc_mc_search->search_type) switch (lc_mc_search->search_type)
{ {
case MC_SEARCH_T_REGEX: case MC_SEARCH_T_REGEX: