From dd22337fc378b6c97ca01c9d5cc1f84bcb4839ee Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 5 Aug 2022 12:44:10 +0200 Subject: [PATCH] FpDebug: fix accessing nil pointer --- components/fpdebug/fpdbgdwarf.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/fpdebug/fpdbgdwarf.pas b/components/fpdebug/fpdbgdwarf.pas index d19861a9f1..19e84d7fd6 100644 --- a/components/fpdebug/fpdbgdwarf.pas +++ b/components/fpdebug/fpdbgdwarf.pas @@ -2614,8 +2614,10 @@ begin if ti <> nil then begin Result := ti.TypeCastValue(Tmp); Tmp.ReleaseReference; - TFpValueDwarf(Result).SetStructureValue(Self); - TFpValueDwarf(Result).Context := Context; + if Result <> nil then begin // TODO: maybe return "tmp" ?? + TFpValueDwarf(Result).SetStructureValue(Self); + TFpValueDwarf(Result).Context := Context; + end; end else begin Result := Tmp;