summaryrefslogtreecommitdiff
path: root/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2024-06-28 00:50:39 +0200
committercyBerta <cyberta@riseup.net>2024-06-28 00:50:39 +0200
commit232328c078eb7854ce1a0246098927ba9a59bc98 (patch)
tree70b432fa088f3021d71892baec4b18e82d901580 /app/src/fatweb/java/se.leap.bitmaskclient/appUpdate
parent6dd683f83d261099a7a4eee5101ea1e53d7a06c2 (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.java11
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;
+ }
}
}