diff options
| author | Tadashi G. Takaoka <takaoka@google.com> | 2012-08-06 10:50:19 +0900 |
|---|---|---|
| committer | Tadashi G. Takaoka <takaoka@google.com> | 2012-08-06 11:09:50 +0900 |
| commit | 4e9e6cd1544f59be2ae02536af62fe5301e0cebb (patch) | |
| tree | 20556cfa9012e9e3124cd830198dcda5b4f7a04b /java/src/com/android/inputmethod/keyboard/KeyDetector.java | |
| parent | 0ef87868c2a1f0cb0249cfc0e53c357f04ea9366 (diff) | |
Fix IllegalStateException of KeyDetector
A KeyDetector without Keyboard may exist in some rare cases. This
change eliminates throwing IllegalStateException and checks explicitly
against null.
Bug: 6891020
Change-Id: I29ec3e9f10484f30288fac76f0c45b3707bc2259
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyDetector.java')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyDetector.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index a3b7776b3..97d88af4a 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -37,8 +37,9 @@ public class KeyDetector { } public void setKeyboard(Keyboard keyboard, float correctionX, float correctionY) { - if (keyboard == null) + if (keyboard == null) { throw new NullPointerException(); + } mCorrectionX = (int)correctionX; mCorrectionY = (int)correctionY; mKeyboard = keyboard; @@ -58,8 +59,6 @@ public class KeyDetector { } public Keyboard getKeyboard() { - if (mKeyboard == null) - throw new IllegalStateException("keyboard isn't set"); return mKeyboard; } |
