summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-16 11:21:28 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-16 11:21:28 +0200
commita2cc0c689fbc222f1b9ff40d54c01a47ba88f8ce (patch)
tree5fe4c0f09b132febcb339a4cc01217df053e2505
parentecc31bf17b0f1c4b9d698c1452f09495c5e947ac (diff)
downloadfpGUI-a2cc0c689fbc222f1b9ff40d54c01a47ba88f8ce.tar.xz
richview: extra check to make sure LineIndex is in range.
This shoud prevent the 'Index out of bounds' errors.
-rw-r--r--docview/components/richtext/RichTextLayoutUnit.pas6
1 files changed, 5 insertions, 1 deletions
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;