From 3fa5813ea386e83859834f214b840bfee8f33d1d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 28 Aug 2011 23:50:50 -0400 Subject: [PATCH] testappchooser: handle 'no app selected' gracefully The test was assuming that it always gets an app info back, when in reality it might get NULL back. --- tests/testappchooser.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/testappchooser.c b/tests/testappchooser.c index 6bf121a685..dd40ed6b87 100644 --- a/tests/testappchooser.c +++ b/tests/testappchooser.c @@ -41,10 +41,14 @@ dialog_response (GtkDialog *d, if (response_id == GTK_RESPONSE_OK) { app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (d)); - name = g_app_info_get_name (app_info); - g_print ("Application selected: %s\n", name); - - g_object_unref (app_info); + if (app_info) + { + name = g_app_info_get_name (app_info); + g_print ("Application selected: %s\n", name); + g_object_unref (app_info); + } + else + g_print ("No application selected\n"); } gtk_widget_destroy (GTK_WIDGET (d));