changeset 642:880cd914c3fd trunk

[svn] Robustness fix; skinning dialog should deal with incorrect current skin setting gracefully. By external contributor Daniel Drake (Gentoo).
author chainsaw
date Sun, 19 Feb 2006 05:48:58 -0800
parents 76ebe33bb152
children 7ca6e22bab48
files audacious/skinwin.c
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/skinwin.c	Sat Feb 18 16:36:33 2006 -0800
+++ b/audacious/skinwin.c	Sun Feb 19 05:48:58 2006 -0800
@@ -263,6 +263,7 @@
     GtkTreeSelection *selection = NULL;
     GtkListStore *store;
     GtkTreeIter iter, iter_current_skin;
+    gboolean have_current_skin = FALSE;
     GtkTreePath *path;
 
     GdkPixbuf *thumbnail;
@@ -296,19 +297,23 @@
 
         if (g_strstr_len(bmp_active_skin->path,
                          strlen(bmp_active_skin->path), name) ) {
-	    iter_current_skin = iter;
-	}
+            iter_current_skin = iter;
+            have_current_skin = TRUE;
+        }
 
         while (gtk_events_pending())
             gtk_main_iteration();
     }
 
-    selection = gtk_tree_view_get_selection(treeview);
-    gtk_tree_selection_select_iter(selection, &iter_current_skin);
+    if (have_current_skin) {
+        selection = gtk_tree_view_get_selection(treeview);
+        gtk_tree_selection_select_iter(selection, &iter_current_skin);
 
-    path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter_current_skin);
-    gtk_tree_view_scroll_to_cell(treeview, path, NULL, TRUE, 0.5, 0.5);
-    gtk_tree_path_free(path);
+        path = gtk_tree_model_get_path(GTK_TREE_MODEL(store),
+		                               &iter_current_skin);
+        gtk_tree_view_scroll_to_cell(treeview, path, NULL, TRUE, 0.5, 0.5);
+        gtk_tree_path_free(path);
+    }
 
     gtk_widget_set_sensitive(GTK_WIDGET(treeview), TRUE);
 }