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.
This commit is contained in:
Julian Winkler 2024-10-31 07:24:45 +01:00
parent e2f41610de
commit 6162868bd1

View file

@ -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)