[dacp] Fix null dereference on missing mode param

Fixes #1907
This commit is contained in:
ejurgensen 2025-07-24 18:08:10 +02:00 committed by GitHub
parent 6d604a176a
commit 5e4d40ee03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1852,15 +1852,16 @@ dacp_reply_playqueueedit_clear(struct httpd_request *hreq)
const char *param;
struct player_status status;
param = httpd_query_value_find(hreq->query, "mode");
/*
* The mode parameter contains the playlist to be cleared.
* If mode=0x68697374 (hex representation of the ascii string "hist") clear the history,
* otherwise the current playlist.
*/
if (strcmp(param,"0x68697374") == 0)
player_queue_clear_history();
param = httpd_query_value_find(hreq->query, "mode");
if (param && strcmp(param,"0x68697374") == 0)
{
player_queue_clear_history();
}
else
{
player_get_status(&status);