From 17b9ce0969bdbd1846c899dcb1f09b38a43b58f8 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 30 Jan 2022 15:34:54 +0100 Subject: [PATCH] [smartpl/daap] Fix some error checks after PR #1386 --- src/dmap_common.c | 3 +++ src/smartpl_query.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dmap_common.c b/src/dmap_common.c index 979e0b96..cb091093 100644 --- a/src/dmap_common.c +++ b/src/dmap_common.c @@ -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) diff --git a/src/smartpl_query.c b/src/smartpl_query.c index 1f7566c2..b0411d5d 100644 --- a/src/smartpl_query.c +++ b/src/smartpl_query.c @@ -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;