diff --git a/framework/android/src/main/java/com/tencent/mtt/hippy/devsupport/DevServerImpl.java b/framework/android/src/main/java/com/tencent/mtt/hippy/devsupport/DevServerImpl.java index dd04a9f89e7..5d3a52028e5 100644 --- a/framework/android/src/main/java/com/tencent/mtt/hippy/devsupport/DevServerImpl.java +++ b/framework/android/src/main/java/com/tencent/mtt/hippy/devsupport/DevServerImpl.java @@ -31,6 +31,7 @@ import com.tencent.mtt.hippy.HippyGlobalConfigs; import com.tencent.mtt.hippy.utils.LogUtils; import com.tencent.mtt.hippy.utils.UIThreadUtils; +import java.util.EmptyStackException; import java.util.HashMap; import java.util.Stack; @@ -214,7 +215,7 @@ public void run() { if (mExceptionDialog != null && mExceptionDialog.isShowing()) { return; } - DevFloatButton button = mDevButtonStack.peek(); + DevFloatButton button = (mDevButtonStack.size() > 0) ? mDevButtonStack.peek() : null; if (button != null) { mExceptionDialog = new DevExceptionDialog(button.getContext()); mExceptionDialog.handleException(throwable); diff --git a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java index 7f42e845def..c30123a171f 100644 --- a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java +++ b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/ControllerManager.java @@ -442,8 +442,9 @@ public VirtualNode createVirtualNode(int rootId, int id, int pid, int index, @NonNull String className, @Nullable Map props) { HippyViewController controller = mControllerRegistry.getViewController(className); - if (controller != null) { - return controller.createVirtualNode(rootId, id, pid, index, props); + Renderer renderer = mRendererWeakRef.get(); + if (controller != null && renderer instanceof NativeRender) { + return controller.createVirtualNode(rootId, id, pid, index, props, (NativeRender) renderer); } return null; } diff --git a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/HippyViewController.java b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/HippyViewController.java index be449deac6e..505647035f8 100644 --- a/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/HippyViewController.java +++ b/renderer/native/android/src/main/java/com/tencent/mtt/hippy/uimanager/HippyViewController.java @@ -400,7 +400,7 @@ protected RenderNode createRenderNode(int rootId, int id, @Nullable Map props) { + @Nullable Map props, @NonNull NativeRender nativeRender) { // The host can create customize virtual node in a derived class. return null; }