forked from AuroraMiddleware/gtk
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)
|
if (response_id == GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (d));
|
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (d));
|
||||||
name = g_app_info_get_name (app_info);
|
if (app_info)
|
||||||
g_print ("Application selected: %s\n", name);
|
{
|
||||||
|
name = g_app_info_get_name (app_info);
|
||||||
g_object_unref (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));
|
gtk_widget_destroy (GTK_WIDGET (d));
|
||||||
|
Loading…
Reference in New Issue
Block a user