From dbc59c374a0954fc2c83403b4cb4b0373beed304 Mon Sep 17 00:00:00 2001
From: HuiNeng6 <3650306360@qq.com>
Date: Wed, 25 Mar 2026 07:18:59 +0800
Subject: [PATCH] fix(debugger): disable copy button when Call Stack has no
frames
- Add guard in handleCopyStack to return early if frames array is empty
- Disable copy button when there are no stack frames to prevent empty clipboard overwrite
- Fixes issue where copy action could silently wipe user's clipboard with empty string
Fixes #37588
---
src/components/debugger/CallStackPanel.tsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/components/debugger/CallStackPanel.tsx b/src/components/debugger/CallStackPanel.tsx
index 5b702af2..3febad18 100644
--- a/src/components/debugger/CallStackPanel.tsx
+++ b/src/components/debugger/CallStackPanel.tsx
@@ -143,6 +143,8 @@ export function CallStackPanel() {
};
const handleCopyStack = async () => {
+ // Guard: do not overwrite clipboard when there are no frames
+ if (frames().length === 0) return;
const text = frames()
.map((f) => {
const loc = f.source?.path ? `${f.source.path}:${f.line}${f.column > 0 ? `:${f.column}` : ""}` : "unknown";
@@ -162,7 +164,7 @@ export function CallStackPanel() {
-
+