X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=5b5f9e113ce57220f5fe2320eb810e501684ae9b;hb=97e23e394d0f6a3150534487e2a174b974b6e230;hp=e00f5ddf765466475a7fc605f18c9a48fee37cce;hpb=48bad6998f4c279090c68f7e127078c9af76cc68;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index e00f5dd..5b5f9e1 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -389,7 +389,7 @@ public class DictionaryActivity extends ActionBarActivity { for (final Index index : dictionary.indices) { final String searchToken = index.sortedIndexEntries.get(0).token; final IndexEntry entry = index.findExact(searchToken); - if (!searchToken.equals(entry.token)) { + if (entry == null || !searchToken.equals(entry.token)) { Log.e(LOG, "Couldn't find token: " + searchToken + ", " + entry.token); } } @@ -1095,8 +1095,11 @@ public class DictionaryActivity extends ActionBarActivity { if (keyCode == KeyEvent.KEYCODE_ENTER) { Log.d(LOG, "Trying to hide soft keyboard."); final InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), - InputMethodManager.HIDE_NOT_ALWAYS); + View focus = getCurrentFocus(); + if (focus != null) { + inputManager.hideSoftInputFromWindow(focus.getWindowToken(), + InputMethodManager.HIDE_NOT_ALWAYS); + } return true; } return super.onKeyDown(keyCode, event);