From 37c0fc51def82b1ce4ca761da157ec3f9ab63156 Mon Sep 17 00:00:00 2001 From: maxli Date: Tue, 26 Nov 2024 17:07:58 +0800 Subject: [PATCH] fix(android): avoid peek EmptyStackException --- .../java/com/tencent/mtt/hippy/devsupport/DevServerImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);