diff options
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java index a0b470add..7c0b7eaef 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java @@ -459,11 +459,16 @@ public class PassphraseCacheService extends Service { * Called when one specific passphrase for keyId timed out */ private void timeout(long keyId) { + CachedPassphrase cPass = mPassphraseCache.get(keyId); - // clean internal char[] from memory! - cPass.getPassphrase().removeFromMemory(); - // remove passphrase object - mPassphraseCache.remove(keyId); + if (cPass != null) { + if (cPass.getPassphrase() != null) { + // clean internal char[] from memory! + cPass.getPassphrase().removeFromMemory(); + } + // remove passphrase object + mPassphraseCache.remove(keyId); + } Log.d(Constants.TAG, "PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!"); |