[WEEX-261][android]Flat GUI NullPointerException fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9dcd0cdb Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9dcd0cdb Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9dcd0cdb Branch: refs/heads/master Commit: 9dcd0cdb6558228d2b6b59f63e8326495bb13cfd Parents: a1d4ed2 Author: jianbai.gbj <[email protected]> Authored: Thu Mar 22 14:25:24 2018 +0800 Committer: misakuo <[email protected]> Committed: Thu Mar 22 15:43:30 2018 +0800 ---------------------------------------------------------------------- .../main/java/com/taobao/weex/ui/component/WXComponent.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9dcd0cdb/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java ---------------------------------------------------------------------- diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java index 6522c9b..1dfb506 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java @@ -553,10 +553,14 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi private void setComponentLayoutParams(int realWidth, int realHeight, int realLeft, int realTop, int realRight, int realBottom, Point rawOffset) { + if(getInstance() == null || getInstance().isDestroy()){ + return; + } + FlatGUIContext UIImp = getInstance().getFlatUIContext(); WidgetContainer ancestor; Widget widget; - if ((ancestor = UIImp.getFlatComponentAncestor(this)) != null) { + if (UIImp != null && (ancestor = UIImp.getFlatComponentAncestor(this)) != null) { if (this instanceof FlatComponent && !((FlatComponent) this).promoteToView(true)) { widget = ((FlatComponent) this).getOrCreateFlatWidget(); } else {
