You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by mi...@apache.org on 2018/03/26 04:23:50 UTC

[2/5] incubator-weex git commit: [WEEX-261][android]Flat GUI NullPointerException fix

[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/6e5558be
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6e5558be
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6e5558be

Branch: refs/heads/master
Commit: 6e5558bef03ed69f7d651ac09db46c201309a9c3
Parents: 8e6299d
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Thu Mar 22 14:25:24 2018 +0800
Committer: jianbai.gbj <ji...@alibaba-inc.com>
Committed: Thu Mar 22 14:25:24 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/6e5558be/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 {