diff options
author | Raj Yengisetty <raj@cyngn.com> | 2016-06-02 09:45:53 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-06-02 11:28:34 -0700 |
commit | 297bc8dab050403b806d820301522c17f4884c3e (patch) | |
tree | f75de63166699f250d4d1cedd3df6affae3747d1 /src | |
parent | 61d4f8311d880d28bf4389ca92a050788f976dd3 (diff) | |
download | android_packages_apps_Dialer-297bc8dab050403b806d820301522c17f4884c3e.tar.gz android_packages_apps_Dialer-297bc8dab050403b806d820301522c17f4884c3e.tar.bz2 android_packages_apps_Dialer-297bc8dab050403b806d820301522c17f4884c3e.zip |
Fix NPE when checking default Dialer
* CallLogFragment may attempt to refresh it's data even when it's
* detached from the activity. Add an activity null check before
* attempting use getActivity for Context.
Ticket: CD-673
Change-Id: I8d003d99c3dfa25cbb9edc9df2dab9fb25523573
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index 4b4e21e1e..cecd76001 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -509,6 +509,11 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis /** Requests updates to the data to be shown. */ private void refreshData() { + if (!isAdded() || getActivity() == null) { + // Fragment is not attached to the activity nothing to do + return; + } + // Prevent unnecessary refresh. if (mRefreshDataRequired) { // Mark all entries in the contact info cache as out of date, so they will be looked up @@ -550,8 +555,13 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis if (!onEntry) { mCallLogQueryHandler.markMissedCallsAsRead(); } - CallLogNotificationsHelper.removeMissedCallNotifications(getActivity()); - CallLogNotificationsHelper.updateVoicemailNotifications(getActivity()); + + Activity activity = getActivity(); + if (activity == null) { + return; + } + CallLogNotificationsHelper.removeMissedCallNotifications(activity); + CallLogNotificationsHelper.updateVoicemailNotifications(activity); } } |