diff --git a/components/fpdebug/fppascalparser.pas b/components/fpdebug/fppascalparser.pas index 4691ddc055..9fd6d4ef87 100644 --- a/components/fpdebug/fppascalparser.pas +++ b/components/fpdebug/fppascalparser.pas @@ -1854,6 +1854,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') @@ -1919,7 +1923,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;