From ee1091cfe741af86b6d0ba63b55345ebafcefa35 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Fri, 1 Nov 2024 06:55:41 +0100 Subject: [PATCH] fix: check if body is null (#807) --- dap-mode.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dap-mode.el b/dap-mode.el index 2241e341..0b25e7cd 100644 --- a/dap-mode.el +++ b/dap-mode.el @@ -790,12 +790,13 @@ will be reversed." (dap--send-message (dap--make-request "source" (list :sourceReference sourceReference)) (dap--resp-handler - (-lambda ((&hash "body" (&hash "content" content))) - (switch-to-buffer (generate-new-buffer sourceReferenceKey)) - (insert content) - (goto-char (point-min)) - (forward-line (1- line)) - (forward-char column)) + (-lambda ((&hash "body" body)) + (let ((content (if body (gethash "content" body) ""))) + (switch-to-buffer (generate-new-buffer sourceReferenceKey)) + (insert content) + (goto-char (point-min)) + (forward-line (1- line)) + (forward-char column))) (lambda (errmsg) (message "No source code for %s. Cursor at %s:%s. Error: %s." name line column errmsg))) debug-session))))