From 43e385a90b84c39bf45837003900d3de65c6a1aa Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 17 May 2022 15:19:50 +0200 Subject: [PATCH] IdeDebugger: Fix nil pointer access in "Fix Display-Format related conversion of numeric watches." 28ac5176a9b40e8957f50fc413953fb75bc1127a --- debugger/watchesdlg.pp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/debugger/watchesdlg.pp b/debugger/watchesdlg.pp index a75e67dcc7..c13ceb48f0 100644 --- a/debugger/watchesdlg.pp +++ b/debugger/watchesdlg.pp @@ -882,6 +882,7 @@ var i: integer; d: TIdeWatchValue; t: TDBGType; + s: String; begin if not nbInspect.Visible then exit; DebugBoss.LockCommandProcessing; @@ -895,6 +896,12 @@ begin exit; InspectLabel.Caption := Watch.Expression; + if not(Watch.Enabled and Watch.HasAllValidParents(GetThreadId, GetStackframe)) then begin + InspectMemo.WordWrap := True; + InspectMemo.Text := ''; + exit; + end; + d := Watch.Values[GetThreadId, GetStackframe]; if d = nil then begin InspectMemo.WordWrap := True; @@ -934,7 +941,11 @@ begin end; InspectMemo.WordWrap := True; - InspectMemo.Text := DebugBoss.FormatValue(d.TypeInfo, PrintWatchValue(d.ResultData, d.DisplayFormat)); + if d.ResultData <> nil then + s := PrintWatchValue(d.ResultData, d.DisplayFormat) + else + s := d.Value; + InspectMemo.Text := DebugBoss.FormatValue(d.TypeInfo, s); finally DebugBoss.UnLockCommandProcessing; end;