@@ -475,19 +475,36 @@ pub fn dap_variables(cx: &mut Context) {
476 if debugger.thread_id.is_none() {
476 if debugger.thread_id.is_none() {
477 cx.editor
477 cx.editor
478− .set_status("Cannot access variables while target is running");
478+ .set_status("Cannot access variables while target is running.");
481 let (frame, thread_id) = match (debugger.active_frame, debugger.thread_id) {
481 let (frame, thread_id) = match (debugger.active_frame, debugger.thread_id) {
482 (Some(frame), Some(thread_id)) => (frame, thread_id),
482 (Some(frame), Some(thread_id)) => (frame, thread_id),
484 cx.editor
484 cx.editor
485− .set_status("Cannot find current stack frame to access variables");
485+ .set_status("Cannot find current stack frame to access variables.");
490− let frame_id = debugger.stack_frames[&thread_id][frame].id;
490+ let thread_frame = match debugger.stack_frames.get(&thread_id) {
491+ Some(thread_frame) => thread_frame,
494+ .set_error("Failed to get stack frame for thread: {thread_id}");
498+ let stack_frame = match thread_frame.get(frame) {
499+ Some(stack_frame) => stack_frame,
502+ .set_error("Failed to get stack frame for thread {thread_id} and frame {frame}.");
507+ let frame_id = stack_frame.id;
491 let scopes = match block_on(debugger.scopes(frame_id)) {
508 let scopes = match block_on(debugger.scopes(frame_id)) {
492 Ok(s) => s,
509 Ok(s) => s,
493 Err(e) => {
510 Err(e) => {