From f72478261a07df2f255799a9a545682097a0fb5f Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 22 Oct 2011 10:13:33 +0000 Subject: [PATCH] codetools: FindNextComment: fixed if MaxPos<1 git-svn-id: trunk@33016 - --- components/codetools/basiccodetools.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index b4f7723989..6c2247d042 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -1183,7 +1183,11 @@ begin end; inc(Result); end; - if Result>=MaxPos+1 then Result:=NotFoundPos; + if Result>MaxPos then + if NotFoundPos>=1 then + Result:=NotFoundPos + else + Result:=MaxPos+1; end; procedure FindCommentsInRange(const Src: string; StartPos, EndPos: integer;