From a2cc0c689fbc222f1b9ff40d54c01a47ba88f8ce Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 16 Aug 2011 11:21:28 +0200 Subject: richview: extra check to make sure LineIndex is in range. This shoud prevent the 'Index out of bounds' errors. --- docview/components/richtext/RichTextLayoutUnit.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'docview/components/richtext') diff --git a/docview/components/richtext/RichTextLayoutUnit.pas b/docview/components/richtext/RichTextLayoutUnit.pas index f79567e0..0577e4c3 100644 --- a/docview/components/richtext/RichTextLayoutUnit.pas +++ b/docview/components/richtext/RichTextLayoutUnit.pas @@ -862,7 +862,11 @@ begin end; LineIndex := FNumLines - 1; - Remainder := FLines[LineIndex].Height; + { check for a valid range } + if (LineIndex < 0) or (LineIndex > FLines.Count-1) then + Remainder := 0 + else + Remainder := FLines[LineIndex].Height; Result := tpBelowText; end; -- cgit v1.2.3-70-g09d2