[smartpl/daap] Fix some error checks after PR #1386

This commit is contained in:
ejurgensen 2022-01-30 15:34:54 +01:00
parent bc1c3e7bd3
commit 17b9ce0969
2 changed files with 10 additions and 1 deletions

View File

@ -642,6 +642,9 @@ dmap_query_parse_sql(const char *dmap_query)
{
struct daap_result result;
if (!dmap_query)
return NULL;
DPRINTF(E_SPAM, L_DAAP, "Parse DMAP query input '%s'\n", dmap_query);
if (daap_lex_parse(&result, dmap_query) != 0)

View File

@ -90,6 +90,12 @@ smartpl_query_parse_string(struct smartpl *smartpl, const char *expression)
{
struct smartpl_result result;
if (!expression)
{
DPRINTF(E_WARN, L_SCAN, "Parse smartpl query input is null\n");
return -1;
}
DPRINTF(E_SPAM, L_SCAN, "Parse smartpl query input '%s'\n", expression);
if (smartpl_lex_parse(&result, expression) != 0)
@ -98,7 +104,7 @@ smartpl_query_parse_string(struct smartpl *smartpl, const char *expression)
return -1;
}
if (!result.title || !result.where)
if (result.title[0] == '\0' || !result.where)
{
DPRINTF(E_LOG, L_SCAN, "Missing title or filter when parsing '%s'\n", expression);
return -1;