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 | f7b1198b6194addfd3ce39849508f7d2a1385164 (patch) | |
| tree | 28189a75d2ea63988b6bb40fbc9f16b745ba0d76 | |
| parent | fa88774c59e397c2565dcbffaabb5308c96e8994 (diff) | |
| download | scintilla-mirror-f7b1198b6194addfd3ce39849508f7d2a1385164.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]; } |
