From 67480873abf7fef27fe0899e19f9b353e63ad30b Mon Sep 17 00:00:00 2001 From: Mis012 Date: Thu, 13 Jun 2024 20:57:48 +0200 Subject: [PATCH] main-executable: handle NULL icon/package name jstring --- src/main-executable/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main-executable/main.c b/src/main-executable/main.c index 19e89fc2..2f1f0a6f 100644 --- a/src/main-executable/main.c +++ b/src/main-executable/main.c @@ -450,11 +450,13 @@ static void open(GtkApplication *app, GFile** files, gint nfiles, const gchar* h /* -- set the window title and app icon -- */ - package_name = _CSTRING((*env)->CallObjectMethod(env, activity_object, handle_cache.context.get_package_name)); + jstring package_name_jstr = (*env)->CallObjectMethod(env, activity_object, handle_cache.context.get_package_name); + package_name = package_name_jstr ? _CSTRING(package_name_jstr) : NULL; if((*env)->ExceptionCheck(env)) (*env)->ExceptionDescribe(env); - const char *app_icon_path = _CSTRING((*env)->CallObjectMethod(env, application_object, handle_cache.application.get_app_icon_path)); + jstring app_icon_path_jstr = (*env)->CallObjectMethod(env, application_object, handle_cache.application.get_app_icon_path); + const char *app_icon_path = app_icon_path_jstr ? _CSTRING(app_icon_path_jstr) : NULL; if((*env)->ExceptionCheck(env)) (*env)->ExceptionDescribe(env);