diff options
author | cyBerta <cyberta@riseup.net> | 2024-06-28 00:50:39 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2024-06-28 00:50:39 +0200 |
commit | 232328c078eb7854ce1a0246098927ba9a59bc98 (patch) | |
tree | 70b432fa088f3021d71892baec4b18e82d901580 /app/src/fatweb/java/se.leap.bitmaskclient/appUpdate | |
parent | 6dd683f83d261099a7a4eee5101ea1e53d7a06c2 (diff) |
use modern switch statement and avoid possible null-pointer exception in UpdateDownloadManager
Diffstat (limited to 'app/src/fatweb/java/se.leap.bitmaskclient/appUpdate')
-rw-r--r-- | app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java | 11 |
1 files changed, 7 insertions, 4 deletions
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; + } } } |