aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-12-19 13:08:21 +0000
committerKalle Wallin <kaw@linux.se>2004-12-19 13:08:21 +0000
commit3a85ad187b227147ee3f77fc1e204608180ceecd (patch)
tree6f302f3848f2af357ad9842237e784ffc2e828c5
parentb5cfc9320d75a93809d77751f2d9e220b7a09219 (diff)
downloadmpd-3a85ad187b227147ee3f77fc1e204608180ceecd.tar.gz
mpd-3a85ad187b227147ee3f77fc1e204608180ceecd.tar.xz
mpd-3a85ad187b227147ee3f77fc1e204608180ceecd.zip
Bugfix from Niko Tyni, survive select and mouse operations on empty list
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@2808 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--src/screen_file.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/screen_file.c b/src/screen_file.c
index 75095db9a..aff58a526 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -363,6 +363,8 @@ browse_handle_enter(screen_t *screen,
filelist_entry_t *entry;
mpd_InfoEntity *entity;
+ if ( filelist==NULL )
+ return -1;
entry = ( filelist_entry_t *) g_list_nth_data(filelist->list, lw->selected);
if( entry==NULL )
return -1;
@@ -442,6 +444,8 @@ browse_handle_select(screen_t *screen,
{
filelist_entry_t *entry;
+ if ( filelist==NULL )
+ return -1;
entry=( filelist_entry_t *) g_list_nth_data(filelist->list, lw->selected);
if( entry==NULL || entry->entity==NULL)
return -1;
@@ -598,12 +602,18 @@ browse_handle_mouse_event(screen_t *screen,
int row;
int prev_selected = lw->selected;
unsigned long bstate;
+ int length;
- if( screen_get_mouse_event(c, lw, filelist->length, &bstate, &row) )
+ if ( filelist )
+ length = filelist->length;
+ else
+ length = 0;
+
+ if( screen_get_mouse_event(c, lw, length, &bstate, &row) )
return 1;
lw->selected = lw->start+row;
- list_window_check_selected(lw, filelist->length);
+ list_window_check_selected(lw, length);
if( bstate & BUTTON1_CLICKED )
{