From 4a8a5bcf5962897b34fb717f27dffe6eedddd9cf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 13 Sep 2009 11:56:42 +0200 Subject: [PATCH] screen_browser: added filelist==NULL checks If ncmpc could not get a list of files, browser->filelist may be NULL. This patch adds two missing checks. --- src/screen_browser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/screen_browser.c b/src/screen_browser.c index 6f29bd7..5f6e048 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -124,7 +124,7 @@ browser_lw_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char **second_c filelist_entry_t *entry; mpd_InfoEntity *entity; - if (idx >= filelist_length(fl)) + if (fl == NULL || idx >= filelist_length(fl)) return NULL; entry = filelist_get(fl, idx); @@ -430,6 +430,9 @@ browser_cmd(struct screen_browser *browser, { struct mpd_song *song; + if (browser->filelist == NULL) + return false; + switch (cmd) { case CMD_PLAY: browser_handle_enter(browser, c); -- 2.30.2