From 4e40d30307c5235b74174138ca9c5071ca654201 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 25 Feb 2016 20:28:00 +0200 Subject: [PATCH] Do nothing if there is no selection --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 24b87fc..ce9ac69 100644 --- 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")); } -- 2.45.2