From 9da44c1c9b6d3ac9dd3f34369e2864820445b46f Mon Sep 17 00:00:00 2001 From: Juha Date: Tue, 29 Mar 2022 19:54:01 +0300 Subject: [PATCH] Codetools: Do not crash when invoking ident completion on empty editor. Issue #39685. --- components/codetools/identcompletiontool.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 9dd3b438eb..70901cb34a 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -2163,7 +2163,7 @@ begin [btSetIgnoreErrorPos]); // Return if CleanCursorPos is before Tree.Root.StartNode. // For example a comment at the beginning of a unit. - if Tree.Root.StartPos>CleanCursorPos then + if (Tree.Root=nil) or (Tree.Root.StartPos>CleanCursorPos) then Exit; if FindDeepestNodeAtPos(CleanCursorPos,false)=nil then begin