From eebd480e8d36bd94227e6c5cd4ac51eef61585ee Mon Sep 17 00:00:00 2001 From: mar-v-in Date: Thu, 14 Aug 2014 16:14:16 +0200 Subject: [PATCH] Fix KeySpinner on cursor change --- .../sufficientlysecure/keychain/ui/widget/KeySpinner.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java index fe3c61197..380361fc0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java @@ -133,7 +133,12 @@ public abstract class KeySpinner extends Spinner { @Override public long getItemId(int position) { - return ((Cursor) getItem(position)).getLong(mIndexMasterKeyId); + try { + return ((Cursor) getItem(position)).getLong(mIndexMasterKeyId); + } catch (Exception e) { + // This can happen on concurrent modification :( + return Constants.key.none; + } } }; }