Codetools: Prevent a crash in FindIdentififerReference on the name of a program. Issue #40753.

(cherry picked from commit 280ada98b2)
This commit is contained in:
Juha 2024-02-22 23:52:44 +02:00 committed by Maxim Ganetsky
parent 2db606a4ed
commit ee4aebfa7d

View File

@ -6445,7 +6445,7 @@ var
//debugln(' Found=',dbgs(Found));
Node:=Params.NewNode;
if Found and (Node<>nil) then begin
if ((Node.Desc=ctnUseUnit) or (Node.Parent.Desc=ctnUseUnit))
if ((Node.Desc=ctnUseUnit) or ((Node.Parent<>nil) and (Node.Parent.Desc=ctnUseUnit)))
and (Params.NewCodeTool=Self) then begin
// identifier is a unit reference
if (DeclarationNode.Desc=ctnSrcName)