From 7a14987c020bddc915e354b0f302e40519c4b19c Mon Sep 17 00:00:00 2001 From: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> Date: Tue, 10 Jun 2025 21:01:30 -0400 Subject: [PATCH] debugger beta: Fix inline value provider panic (#32502) Closes #32143 Release Notes: - debugger beta: Fix panic that could occur when generating inline values --- crates/project/src/debugger/dap_store.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/project/src/debugger/dap_store.rs b/crates/project/src/debugger/dap_store.rs index 368b6da25c4ccb0ecc9df4ab3efa935b2ec8d18f..d3e37e77a64f49d66dd99b31d277945886a2091b 100644 --- a/crates/project/src/debugger/dap_store.rs +++ b/crates/project/src/debugger/dap_store.rs @@ -576,7 +576,12 @@ impl DapStore { const LIMIT: usize = 100; if value.len() > LIMIT { - value.truncate(LIMIT); + let mut index = LIMIT; + // If index isn't a char boundary truncate will cause a panic + while !value.is_char_boundary(index) { + index -= 1; + } + value.truncate(index); value.push_str("..."); }