From 7c9b7d8dcaf4eb5c260f9d12b627ed75d3a6c22e Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Fri, 6 Jun 2025 01:38:03 +0200 Subject: [PATCH] service/dap: do not attempt further loading on unreadable string vars (#4016) Do not attempt further loading of unreadable string vars because their Value field will be nil, causing a panic, and also it can't possibly work. Fixes #4010 --- service/dap/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/dap/server.go b/service/dap/server.go index 8afa571c..ea70547f 100644 --- a/service/dap/server.go +++ b/service/dap/server.go @@ -2899,7 +2899,7 @@ func (s *Session) onEvaluateRequest(request *dap.EvaluateRequest) { ctxt := request.Arguments.Context switch ctxt { case "repl", "variables", "hover", "clipboard": - if exprVar.Kind == reflect.String { + if exprVar.Kind == reflect.String && exprVar.Unreadable == nil { if strVal := constant.StringVal(exprVar.Value); exprVar.Len > int64(len(strVal)) { // Reload the string value with a bigger limit. loadCfg := DefaultLoadConfig