From f5c65d1eef7e08f3c2a52f784578b74fa011d33e Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 5 Mar 2017 08:46:00 +0100 Subject: [PATCH] [db] Do not notify clients in 'db_queue_add_by_query' if no items were added --- src/db.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index 8629e329..3b708d04 100644 --- a/src/db.c +++ b/src/db.c @@ -4194,6 +4194,13 @@ db_queue_add_by_query(struct query_params *qp, char reshuffle, uint32_t item_id) DPRINTF(E_DBG, L_DB, "Player queue query returned %d items\n", qp->results); + if (qp->results == 0) + { + db_query_end(qp); + db_transaction_end(); + return 0; + } + while (((ret = db_query_fetch_file(qp, &dbmfi)) == 0) && (dbmfi.id)) { ret = queue_add_file(&dbmfi, pos, pos); @@ -4217,8 +4224,7 @@ db_queue_add_by_query(struct query_params *qp, char reshuffle, uint32_t item_id) return -1; } - if (pos > 0) - ret = (int) sqlite3_last_insert_rowid(hdl); + ret = (int) sqlite3_last_insert_rowid(hdl); db_transaction_end();