Ticket #1456 (Segfault with replace action)

fix: segfault if 'replace to' is empty and search type is 'Regular expression'
This commit is contained in:
Ilia Maslakov 2009-08-03 20:14:40 +00:00 committed by Ilia Maslakov
parent 07c87f2b27
commit 42a8c4fc0b

View File

@ -305,6 +305,9 @@ mc_search_prepare_replace_str (mc_search_t * mc_search, GString * replace_str)
if (mc_search == NULL)
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 (mc_search->search_type) {
case MC_SEARCH_T_REGEX:
ret = mc_search_regex_prepare_replace_str (mc_search, replace_str);