From de9dde6a0b9362187a9b44c0c2603bf968017064 Mon Sep 17 00:00:00 2001 From: twyen Date: Tue, 6 Feb 2018 14:43:28 -0800 Subject: Fix NPE when querying preferred without an account Bug: 72986691 Test: Unit tests PiperOrigin-RevId: 184743227 Change-Id: I2e37c2916ce05a72324f68c4530b7f6f3daf23eb --- java/com/android/dialer/precall/impl/CallingAccountSelector.java | 2 +- java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'java') 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. */ -- cgit v1.2.3