From a34e1f55ed3e5f14492c448d2bdb166ee70045f1 Mon Sep 17 00:00:00 2001 From: tomikun <60690056+alexytomi@users.noreply.github.com> Date: Fri, 26 Jun 2026 03:26:42 +0800 Subject: [PATCH] fix(NotificationDownloadListener): Crash on no-installer forge versions Fixes #282 --- .../modpacks/api/NotificationDownloadListener.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java index 11615d14d..0dba723be 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java @@ -14,19 +14,20 @@ import java.io.File; public class NotificationDownloadListener implements ModloaderDownloadListener { private final Context mContext; + private final Intent mIntent; private final ModLoader mModLoader; public NotificationDownloadListener(Context context, ModLoader modLoader) { mModLoader = modLoader; mContext = context.getApplicationContext(); + mIntent = new Intent(mContext, LauncherActivity.class); } @Override public void onDownloadFinished(File downloadedFile) { if(mModLoader.requiresGuiInstallation()) { ModloaderInstallTracker.saveModLoader(mContext, mModLoader, downloadedFile); - Intent mainActivityIntent = new Intent(mContext, LauncherActivity.class); - sendIntentNotification(mainActivityIntent, R.string.modpack_install_notification_success); + sendIntentNotification(R.string.modpack_install_notification_success); } } @@ -40,11 +41,11 @@ public class NotificationDownloadListener implements ModloaderDownloadListener { Tools.showErrorRemote(mContext, R.string.modpack_install_modloader_download_failed, e); } - private void sendIntentNotification(Intent intent, int localeString) { + private void sendIntentNotification(int localeString) { Tools.runOnUiThread(() -> NotificationUtils.sendBasicNotification(mContext, R.string.modpack_install_notification_title, localeString, - intent, + mIntent, NotificationUtils.PENDINGINTENT_CODE_DOWNLOAD_SERVICE, NotificationUtils.NOTIFICATION_ID_DOWNLOAD_LISTENER )); @@ -54,7 +55,7 @@ public class NotificationDownloadListener implements ModloaderDownloadListener { Tools.runOnUiThread(()->NotificationUtils.sendBasicNotification(mContext, R.string.modpack_install_notification_title, localeString, - null, + mIntent, NotificationUtils.PENDINGINTENT_CODE_DOWNLOAD_SERVICE, NotificationUtils.NOTIFICATION_ID_DOWNLOAD_LISTENER ));