From 232328c078eb7854ce1a0246098927ba9a59bc98 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 28 Jun 2024 00:50:39 +0200 Subject: use modern switch statement and avoid possible null-pointer exception in UpdateDownloadManager --- .../appUpdate/UpdateDownloadManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'app/src/fatweb/java/se.leap.bitmaskclient/appUpdate') diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java index b04680c9..5907b8fa 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java @@ -114,23 +114,26 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download } Bundle result = new Bundle(); + if (action == null) { + return; + } switch (action) { - case CHECK_VERSION_FILE: + case CHECK_VERSION_FILE -> { result = checkVersionFile(result); if (result.getBoolean(BROADCAST_RESULT_KEY)) { sendToReceiverOrBroadcast(receiver, UPDATE_FOUND, result); } else { sendToReceiverOrBroadcast(receiver, UPDATE_NOT_FOUND, result); } - break; - case DOWNLOAD_UPDATE: + } + case DOWNLOAD_UPDATE -> { result = downloadUpdate(result); if (result.getBoolean(BROADCAST_RESULT_KEY)) { sendToReceiverOrBroadcast(receiver, UPDATE_DOWNLOADED, result); } else { sendToReceiverOrBroadcast(receiver, UPDATE_DOWNLOAD_FAILED, result); } - break; + } } } -- cgit v1.2.3