diff options
-rw-r--r-- | docview/components/richtext/RichTextLayoutUnit.pas | 6 |
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; |