From b06f7759b99dcd2e1f2f883496a10f95c712ce45 Mon Sep 17 00:00:00 2001 From: vvzh Date: Tue, 18 Sep 2012 21:55:00 +0000 Subject: [PATCH] csvdocument: fixed incorrect MaxColCount calculation in TCSVParser if line with most cols is immediately followed by EOF git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2519 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/csvdocument/csvdocument.pas | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/csvdocument/csvdocument.pas b/components/csvdocument/csvdocument.pas index 43ef23ce8..abaedb865 100644 --- a/components/csvdocument/csvdocument.pas +++ b/components/csvdocument/csvdocument.pas @@ -463,17 +463,20 @@ function TCSVParser.ParseNextCell: Boolean; var LineColCount: Integer; begin + if EndOfLine or EndOfFile then + begin + // Having read the previous line, adjust column count if necessary: + LineColCount := FCurrentCol + 1; + if LineColCount > FMaxColCount then + FMaxColCount := LineColCount; + end; + if EndOfFile then Exit(False); // Handle line ending if EndOfLine then begin - // Having read the previous line, adjust column count if necessary: - LineColCount := FCurrentCol + 1; - if LineColCount > FMaxColCount then - FMaxColCount := LineColCount; - SkipEndOfLine; if EndOfFile then Exit(False);