summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-02-06 14:43:28 -0800
committerCopybara-Service <copybara-piper@google.com>2018-02-06 14:57:50 -0800
commitde9dde6a0b9362187a9b44c0c2603bf968017064 (patch)
tree2c66fbd543a3d59d7baa9fd2feb924b7ee22739c
parent325a50b527debd7dfe109b21d90c5b5ccd657d40 (diff)
Fix NPE when querying preferred without an account
Bug: 72986691 Test: Unit tests PiperOrigin-RevId: 184743227 Change-Id: I2e37c2916ce05a72324f68c4530b7f6f3daf23eb
-rw-r--r--java/com/android/dialer/precall/impl/CallingAccountSelector.java2
-rw-r--r--java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index f014b270b..43f668084 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -388,7 +388,7 @@ public class CallingAccountSelector implements PreCallAction {
if (cursor == null || !cursor.moveToFirst()) {
return Optional.absent();
}
- return Optional.of(cursor.getString(0));
+ return Optional.fromNullable(cursor.getString(0));
}
}
diff --git a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
index abb6e980a..0a91d1511 100644
--- a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
+++ b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
@@ -38,6 +38,8 @@ public interface SuggestionProvider {
USER_SET,
// The user has selected the SIM for all contacts on the account.
ACCOUNT,
+ // Unspecified reason.
+ OTHER,
}
/** The suggestion. */