make timeout method in PassphraseCacheService more robust against nullpointers
This commit is contained in:
@@ -459,11 +459,16 @@ public class PassphraseCacheService extends Service {
|
|||||||
* Called when one specific passphrase for keyId timed out
|
* Called when one specific passphrase for keyId timed out
|
||||||
*/
|
*/
|
||||||
private void timeout(long keyId) {
|
private void timeout(long keyId) {
|
||||||
|
|
||||||
CachedPassphrase cPass = mPassphraseCache.get(keyId);
|
CachedPassphrase cPass = mPassphraseCache.get(keyId);
|
||||||
// clean internal char[] from memory!
|
if (cPass != null) {
|
||||||
cPass.getPassphrase().removeFromMemory();
|
if (cPass.getPassphrase() != null) {
|
||||||
// remove passphrase object
|
// clean internal char[] from memory!
|
||||||
mPassphraseCache.remove(keyId);
|
cPass.getPassphrase().removeFromMemory();
|
||||||
|
}
|
||||||
|
// remove passphrase object
|
||||||
|
mPassphraseCache.remove(keyId);
|
||||||
|
}
|
||||||
|
|
||||||
Log.d(Constants.TAG, "PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!");
|
Log.d(Constants.TAG, "PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user