summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Attwell <brianattwell@google.com>2015-06-05 10:49:19 -0700
committerBrian Attwell <brianattwell@google.com>2015-06-05 10:49:19 -0700
commit61c63d03df0d87f27f572eb1c168a454bf836df8 (patch)
tree79c2b5afb0c47546cb8448a7955c1ed300236546 /src
parent02941b68472c5ae241a03e1bbdb4117921f3d257 (diff)
downloadpackages_apps_Contacts-61c63d03df0d87f27f572eb1c168a454bf836df8.tar.gz
packages_apps_Contacts-61c63d03df0d87f27f572eb1c168a454bf836df8.tar.bz2
packages_apps_Contacts-61c63d03df0d87f27f572eb1c168a454bf836df8.zip
Check for null getCurrentFocus(). Fix NPE
Bug: 21644090 Change-Id: If09f89d806410e4f6850f0fabdb00bfbe093a33d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/activities/ContactEditorBaseActivity.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com/android/contacts/activities/ContactEditorBaseActivity.java b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
index 5c4592813..eaf607d07 100644
--- a/src/com/android/contacts/activities/ContactEditorBaseActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
@@ -38,6 +38,7 @@ import android.os.Bundle;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.RawContacts;
import android.util.Log;
+import android.view.View;
import android.view.inputmethod.InputMethodManager;
import java.util.ArrayList;
@@ -228,9 +229,10 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity
@Override
protected void onPause() {
super.onPause();
- InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- if (imm != null) {
- imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
+ final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
+ final View currentFocus = getCurrentFocus();
+ if (imm != null && currentFocus != null) {
+ imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
}
}