Fix compiler warning about uninitialized variable in desktop-app-info test

It would always be initialized but initialize it to NULL to silence the
compiler, and also check that it is not NULL anymore when we expect it
to contain a valid value.

../gio/tests/desktop-app-info.c: In function ‘test_fallback’:
../gio/tests/desktop-app-info.c:191:18: warning: ‘app’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   g_assert_true (g_app_info_equal (info1, app));
                  ^~~~~~~~~~~~~~~~
This commit is contained in:
Sebastian Dröge 2019-01-24 16:37:23 +02:00
parent b4a5157f95
commit bd75dffc00

View File

@ -155,7 +155,7 @@ test_default (void)
static void
test_fallback (void)
{
GAppInfo *info1, *info2, *app;
GAppInfo *info1, *info2, *app = NULL;
GList *apps, *recomm, *fallback, *list, *l, *m;
GError *error = NULL;
gint old_length;
@ -188,6 +188,7 @@ test_fallback (void)
if (g_app_info_equal (info1, app))
break;
}
g_assert_nonnull (app);
g_assert_true (g_app_info_equal (info1, app));
/* and that Test2 is among the fallback apps */