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

Commit 77df2019 authored by Brian Attwell's avatar Brian Attwell Committed by Android Git Automerger
Browse files

am 6c6a5863: am 61c63d03: Check for null getCurrentFocus(). Fix NPE

* commit '6c6a5863':
  Check for null getCurrentFocus(). Fix NPE
parents 66c80f29 6c6a5863
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);
        }
    }