]> git.tdb.fi Git - pmount-gui.git/commitdiff
Do nothing if there is no selection
authorMikko Rasa <tdb@tdb.fi>
Thu, 25 Feb 2016 18:28:00 +0000 (20:28 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 25 Feb 2016 18:28:00 +0000 (20:28 +0200)
main.c

diff --git a/main.c b/main.c
index 24b87fc5994ee8e5c70a4e4a58822eff14b38117..ce9ac69d62ed23540b2cc1271c66ea25e86ea90d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -777,7 +777,9 @@ void selection_changed(GtkTreeSelection *selection, gpointer user_data)
        GtkTreeModel *model;
        Device *device;
 
-       gtk_tree_selection_get_selected(selection, &model, &iter);
+       if(!gtk_tree_selection_get_selected(selection, &model, &iter))
+               return;
+
        gtk_tree_model_get(model, &iter, 1, &device, -1);
        gtk_button_set_label(GTK_BUTTON(context->button), (device->mount_point ? "Unmount" : "Mount"));
 }