diff options
author | Mook <marky@activestate.com> | 2012-10-26 13:43:14 -0700 |
---|---|---|
committer | Mook <marky@activestate.com> | 2012-10-26 13:43:14 -0700 |
commit | b8794a4b06ebfa17fe78674a0a6731e328919104 (patch) | |
tree | 13f498cd96a72be881238e36919471e378e958ed | |
parent | 811b4ce918bd857cf131cc28053b38e1bdc4cfc2 (diff) | |
download | scintilla-mirror-b8794a4b06ebfa17fe78674a0a6731e328919104.tar.gz |
cocoa: avoid dividing by zero when setting vertical scroll position
-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]; } |