diff options
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 64981d9d6..fac9a0bc1 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1522,7 +1522,8 @@ void ScintillaCocoa::SetVerticalScrollPos() // Convert absolute coordinate into the range [0..1]. Keep in mind that the visible area // does *not* belong to the scroll range. - float relativePosition = (float) topLine / MaxScrollPos(); + int maxScrollPos = MaxScrollPos(); + float relativePosition = (maxScrollPos > 0) ? ((float) topLine / maxScrollPos) : 0f; [topContainer setVerticalScrollPosition: relativePosition]; } |