Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 156d1986 authored by Brian Attwell's avatar Brian Attwell Committed by The Android Automerger
Browse files

Check for null getCurrentFocus(). Fix NPE

Bug: 21644090
Change-Id: If09f89d806410e4f6850f0fabdb00bfbe093a33d
parent ee5cd57a
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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);
        }
    }