mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
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.
This commit is contained in:
parent
18dba17f0b
commit
3fa5813ea3
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user