summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/gtkui/callbacks.c3
-rw-r--r--plugins/gtkui/search.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 8d82b8c4..31bdb4e8 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -517,6 +517,9 @@ on_remove1_activate (GtkMenuItem *menuitem,
gtkplaylist_t *ps = &main_playlist;
GtkWidget *widget = ps->playlist;
int row = deadbeef->pl_delete_selected ();
+ if (row >= ps->get_count ()) {
+ row = ps->get_count ()-1;
+ }
deadbeef->pl_set_cursor (PL_MAIN, row);
if (row != -1) {
DB_playItem_t *it = deadbeef->pl_get_for_idx (row);
diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c
index 55b5ad3f..c07d503f 100644
--- a/plugins/gtkui/search.c
+++ b/plugins/gtkui/search.c
@@ -74,6 +74,10 @@ on_searchentry_changed (GtkEditable *editable,
extern gtkplaylist_t search_playlist;
gtkplaylist_t *ps = &search_playlist;
+ int row = deadbeef->pl_get_cursor (ps->iterator);
+ if (row >= ps->get_count ()) {
+ deadbeef->pl_set_cursor (ps->iterator, ps->get_count () - 1);
+ }
gtkpl_setup_scrollbar (ps);
//memset (ps->fmtcache, 0, sizeof (int16_t) * 3 * pl_ncolumns * ps->nvisiblerows);
gtkpl_draw_playlist (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height);