core: fix regex replace in eval_expression when regex or regex_replace is empty

This commit is contained in:
Sébastien Helleu 2014-11-23 08:31:29 +01:00
parent 3fac3b1bf9
commit ae013b7881

View File

@ -1080,7 +1080,7 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
/* check for regex */ /* check for regex */
ptr_value = hashtable_get (options, "regex"); ptr_value = hashtable_get (options, "regex");
if (ptr_value && ptr_value[0]) if (ptr_value)
{ {
regex = malloc (sizeof (*regex)); regex = malloc (sizeof (*regex));
if (string_regcomp (regex, ptr_value, if (string_regcomp (regex, ptr_value,
@ -1097,7 +1097,7 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
/* check for regex replacement (evaluated later) */ /* check for regex replacement (evaluated later) */
ptr_value = hashtable_get (options, "regex_replace"); ptr_value = hashtable_get (options, "regex_replace");
if (ptr_value && ptr_value[0]) if (ptr_value)
{ {
regex_replace = ptr_value; regex_replace = ptr_value;
} }