Repository: incubator-weex Updated Branches: refs/heads/master e36379a5a -> 14b294d50
* [android] fix NPE on input component Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/34feb0db Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/34feb0db Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/34feb0db Branch: refs/heads/master Commit: 34feb0db6ae8167be545905728558f8280d2d5c1 Parents: c9a182f Author: misakuo <[email protected]> Authored: Thu Jan 25 10:48:02 2018 +0800 Committer: misakuo <[email protected]> Committed: Thu Jan 25 10:48:02 2018 +0800 ---------------------------------------------------------------------- .../main/java/com/taobao/weex/ui/view/WXEditText.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/34feb0db/android/sdk/src/main/java/com/taobao/weex/ui/view/WXEditText.java ---------------------------------------------------------------------- diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/WXEditText.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/WXEditText.java index 4a47180..a08ac2d 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/view/WXEditText.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/WXEditText.java @@ -84,12 +84,14 @@ public class WXEditText extends EditText implements WXGestureObservable { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); - int contentH = getLayout().getHeight(); - //TODO: known issue,set movement to null will make cursor disappear. - if(mAllowDisableMovement && h < contentH){ - setMovementMethod(null); - } else { - setMovementMethod(getDefaultMovementMethod()); + if (getLayout() != null) { + int contentH = getLayout().getHeight(); + //TODO: known issue,set movement to null will make cursor disappear. + if (mAllowDisableMovement && h < contentH) { + setMovementMethod(null); + } else { + setMovementMethod(getDefaultMovementMethod()); + } } }
