summaryrefslogtreecommitdiff
path: root/tests/testappchooser.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-08-28 23:50:50 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-08-28 23:50:50 -0400
commit3fa5813ea386e83859834f214b840bfee8f33d1d (patch)
tree8067a70c7d312e5c51662c079283468590261e37 /tests/testappchooser.c
parent18dba17f0bbacebf64b65423b2aee64eb2dcc141 (diff)
downloadgtk+-3fa5813ea386e83859834f214b840bfee8f33d1d.tar.gz
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.
Diffstat (limited to 'tests/testappchooser.c')
-rw-r--r--tests/testappchooser.c12
1 files 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));