dfilter: Remove assertion on empty filter expression

Because existing code is dependant on the behavior that a null/empty
filter is a sort of valid input (presumably to avoid having to check
for that condition explicitly) add back that behavior to avoid a lot
of potential hidden cascading failures.
This commit is contained in:
João Valverde 2023-04-21 19:01:33 +01:00
parent c6fb33505e
commit dfffd13892
1 changed files with 8 additions and 2 deletions

View File

@ -593,13 +593,19 @@ dfilter_compile_full(const gchar *text, dfilter_t **dfp,
dfilter_t *dfcode;
df_error_t *error = NULL;
ws_assert(text);
ws_assert(*text);
ws_assert(dfp);
*dfp = NULL;
if (caller == NULL)
caller = "(unknown)";
if (text == NULL || *text == '\0') {
ws_info("Called from %s() with empty filter expression", caller);
if (err_ptr) {
*err_ptr = df_error_new_msg("Empty filter expression");
}
return FALSE;
}
ws_debug("Called from %s() with filter: %s", caller, text);
if (flags & DF_EXPAND_MACROS) {