[neon/backports-focal/xdg-desktop-portal/Neon/unstable] src: open-uri: Assert that find_recommended_choices yields non-NULL

Simon McVittie null at kde.org
Wed Jan 13 06:32:43 GMT 2021


Git commit e068454697b285bd7d1da7501bb0ce229460c125 by Simon McVittie.
Committed on 07/09/2020 at 13:20.
Pushed by ash into branch 'Neon/unstable'.

open-uri: Assert that find_recommended_choices yields non-NULL

choices is never NULL, but might be an array containing only NULL.

Signed-off-by: Simon McVittie <smcv at collabora.com>

M  +2    -0    src/open-uri.c

https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/e068454697b285bd7d1da7501bb0ce229460c125

diff --git a/src/open-uri.c b/src/open-uri.c
index f746e64..c5b8705 100644
--- a/src/open-uri.c
+++ b/src/open-uri.c
@@ -669,6 +669,8 @@ handle_open_in_thread_func (GTask *task,
 
   /* collect all the information */
   find_recommended_choices (scheme, content_type, &default_app, &choices, &n_choices);
+  /* it's never NULL, but might be empty (only contain the NULL terminator) */
+  g_assert (choices != NULL);
   if (default_app != NULL && !app_exists (default_app))
     g_clear_pointer (&default_app, g_free);
   use_default_app = should_use_default_app (scheme, content_type);



More information about the Neon-commits mailing list