From f2cbe3d58258e6827f09cfd35860cb46ed2201c1 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 9 Jun 2022 01:54:31 +0200 Subject: [PATCH] FpDebug: PascalParser fix nil object access. --- components/fpdebug/fppascalparser.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/fpdebug/fppascalparser.pas b/components/fpdebug/fppascalparser.pas index d01ac95a55..441879c9b7 100644 --- a/components/fpdebug/fppascalparser.pas +++ b/components/fpdebug/fppascalparser.pas @@ -1855,6 +1855,10 @@ var var BracketPart: TFpPascalExpressionPartBracket; begin + if (CurPart=nil) then begin + SetError(fpErrPasParserUnexpectedToken, [GetFirstToken(CurPtr), PosFromPChar(CurPtr)]); + exit; + end; BracketPart := CurPart.SurroundingBracket; if BracketPart = nil then begin SetError('Closing bracket found without opening') @@ -1920,7 +1924,7 @@ var procedure HandleComma; begin - if not CurPart.HandleSeparator(ppstComma) then + if (CurPart=nil) or (not CurPart.HandleSeparator(ppstComma)) then SetError(fpErrPasParserUnexpectedToken, [GetFirstToken(CurPtr), PosFromPChar(CurPtr)]); end;