From bd75dffc0075d6ea11022fe1fd11fbda12aa968a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 24 Jan 2019 16:37:23 +0200 Subject: [PATCH] Fix compiler warning about uninitialized variable in desktop-app-info test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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)); ^~~~~~~~~~~~~~~~ --- gio/tests/desktop-app-info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c index dd41af842..ed2f89111 100644 --- a/gio/tests/desktop-app-info.c +++ b/gio/tests/desktop-app-info.c @@ -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 */