From 6162868bd1ecb6ce7d6fb7359ae2e79f2c9d73fc Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Thu, 31 Oct 2024 07:24:45 +0100 Subject: [PATCH] main-executable: handle empty string being passed to --uri The XDG-portal escapes the strings when installing a .desktop file. This causes --uri %u to be replaced with --uri '%u', which causes an empty string to be passed when no URI is specified. --- src/main-executable/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main-executable/main.c b/src/main-executable/main.c index 6db63ead..b41e1128 100644 --- a/src/main-executable/main.c +++ b/src/main-executable/main.c @@ -431,7 +431,7 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h // construct main Activity activity_object = (*env)->CallStaticObjectMethod(env, handle_cache.activity.class, _STATIC_METHOD(handle_cache.activity.class, "createMainActivity", "(Ljava/lang/String;JLjava/lang/String;)Landroid/app/Activity;"), - _JSTRING(d->apk_main_activity_class), _INTPTR(window), uri_option ? _JSTRING(uri_option) : NULL); + _JSTRING(d->apk_main_activity_class), _INTPTR(window), (uri_option && *uri_option) ? _JSTRING(uri_option) : NULL); if ((*env)->ExceptionCheck(env)) (*env)->ExceptionDescribe(env); if (uri_option)