summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-06-01 10:16:20 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-06-01 10:16:20 +0200
commitc94aa6aa8f0e6fc318226c15f1c0f6e139ad37ff (patch)
tree81f3e0b9193fe4f325cfbadff569fc570bcf5323
parent27606b67fc8a6eb8b101afe5ee5db4ad2bbcf98f (diff)
downloadfpGUI-c94aa6aa8f0e6fc318226c15f1c0f6e139ad37ff.tar.xz
Fixed potential division by zero bug.
This can occur when component is displayed with no text. :-/
-rw-r--r--prototypes/textedit/fpg_textedit.pas3
1 files changed, 2 insertions, 1 deletions
diff --git a/prototypes/textedit/fpg_textedit.pas b/prototypes/textedit/fpg_textedit.pas
index ebe66222..bb313717 100644
--- a/prototypes/textedit/fpg_textedit.pas
+++ b/prototypes/textedit/fpg_textedit.pas
@@ -457,7 +457,8 @@ begin
FVScrollBar.PageSize := FVisLines - 4;
FVScrollBar.Max := FLines.Count - FVisLines + 1; // +1 is so the last line is completely visible
FVScrollBar.Position := VPos;
- FVScrollBar.SliderSize := FVisLines / FLines.Count;
+ if FLines.Count > 0 then
+ FVScrollBar.SliderSize := FVisLines / FLines.Count;
FVScrollBar.Visible := FLines.Count > FVisLines;
FHScrollBar.Min := 0;