Code

list_window: don't invoke callback out-of-range
[ncmpc.git] / src / screen_browser.c
index dd97bb22f0f91815dd1e8eda326db64f72ad6dfb..a19fa84f40c7bcfa7e7f927e78150505d7e1be20 100644 (file)
@@ -80,8 +80,8 @@ browser_lw_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char **second_c
        const struct filelist_entry *entry;
        const struct mpd_entity *entity;
 
-       if (fl == NULL || idx >= filelist_length(fl))
-               return NULL;
+       assert(fl != NULL);
+       assert(idx < filelist_length(fl));
 
        entry = filelist_get(fl, idx);
        assert(entry != NULL);