diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 9f769759e..bf6a62782 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -135,7 +135,7 @@ public class KeychainIntentService extends IntentService implements Progressable private static final IOType[] values = values(); public static IOType fromInt(int n) { - if(n >= values.length) { + if(n < 0 || n >= values.length) { return UNKNOWN; } else { return values[n]; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java index c102acc32..bd047518d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java @@ -44,7 +44,7 @@ public class KeychainIntentServiceHandler extends Handler { public static MessageStatus fromInt(int n) { - if(n >= values.length) { + if(n < 0 || n >= values.length) { return UNKNOWN; } else { return values[n];