Code

screen_browser: moved range selection check to browser_get_selected()
authorMax Kellermann <max@duempel.org>
Sun, 13 Sep 2009 07:58:33 +0000 (09:58 +0200)
committerMax Kellermann <max@duempel.org>
Sun, 13 Sep 2009 07:58:33 +0000 (09:58 +0200)
browser_get_selected() should not return an item when multiple items
are selected (range selection).

src/screen_browser.c

index e1b2e5fb6cf2688260ec95893d31615a564b6872..13bad9bf5dc57951cc3882df923a8c9995bd764e 100644 (file)
@@ -273,6 +273,7 @@ static struct filelist_entry *
 browser_get_selected(const struct screen_browser *browser)
 {
        if (browser->filelist == NULL ||
+           browser->lw->selected_start < browser->lw->selected_end ||
            browser->lw->selected >= filelist_length(browser->filelist))
                return NULL;
 
@@ -295,7 +296,7 @@ browser_handle_enter(struct screen_browser *browser, mpdclient_t *c)
        struct filelist_entry *entry = browser_get_selected(browser);
        mpd_InfoEntity *entity;
 
-       if( entry==NULL || browser->lw->selected_start < browser->lw->selected_end)
+       if (entry == NULL)
                return false;
 
        entity = entry->entity;