diff options
author | Max Kellermann <max@duempel.org> | 2008-09-21 22:45:04 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-21 22:45:04 +0200 |
commit | ba91edfee95a6198e2db9804fee9ddfeffa8a199 (patch) | |
tree | a6d7516ca294625630c99d88e3f8088539108be7 /src/screen_browser.c | |
parent | 8beeb6e1d2311a3593a3df0273b778011068e81b (diff) | |
download | mpd-ba91edfee95a6198e2db9804fee9ddfeffa8a199.tar.gz mpd-ba91edfee95a6198e2db9804fee9ddfeffa8a199.tar.xz mpd-ba91edfee95a6198e2db9804fee9ddfeffa8a199.zip |
browser: check if the selection is valid
Don't call filelist_get() with an invalid index.
Diffstat (limited to '')
-rw-r--r-- | src/screen_browser.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/screen_browser.c b/src/screen_browser.c index d2c8aa08e..4c8bc2ed6 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -250,7 +250,8 @@ enqueue_and_play(mpdclient_t *c, filelist_entry_t *entry) static struct filelist_entry * browser_get_selected(const struct screen_browser *browser) { - if (browser->filelist == NULL) + if (browser->filelist == NULL || + browser->lw->selected >= filelist_length(browser->filelist)) return NULL; return filelist_get(browser->filelist, browser->lw->selected); |