diff src/audacious/ui_playlist.c @ 2653:b5a612371920 trunk

[svn] - fix crashes related to alt+click enqueue
author nenolod
date Thu, 05 Apr 2007 17:16:09 -0700
parents 2d0c90f38824
children 26755684c0dc
line wrap: on
line diff
--- a/src/audacious/ui_playlist.c	Thu Apr 05 17:01:26 2007 -0700
+++ b/src/audacious/ui_playlist.c	Thu Apr 05 17:16:09 2007 -0700
@@ -1029,6 +1029,8 @@
     gboolean grab = TRUE;
     gint xpos, ypos;
     GtkRequisition req;
+    Playlist *playlist = playlist_get_active();
+    gint idx = 0;
 
     gtk_window_get_position(GTK_WINDOW(playlistwin), &xpos, &ypos);
 
@@ -1153,16 +1155,20 @@
     }
     else if (event->button == 1 && (event->state & GDK_MOD1_MASK))
     {
-        Playlist *playlist;
-	gint index;
+        GList *node;
 
         handle_press_cb(playlistwin_wlist, widget, event);
         draw_playlist_window(FALSE);
 
-	playlist = playlist_get_active();
-        index = GPOINTER_TO_INT(playlist_get_selected(playlist)->data);
+        node = playlist_get_selected(playlist);
 
-        playlist_queue_position(playlist, index);
+        if (node != NULL)
+        {
+            idx = GPOINTER_TO_INT(playlist_get_selected(playlist)->data);
+            playlist_queue_position(playlist, idx);
+        }
+
+        grab = FALSE;
     }
     else {
         handle_press_cb(playlistwin_wlist, widget, event);