From b8794a4b06ebfa17fe78674a0a6731e328919104 Mon Sep 17 00:00:00 2001 From: Mook Date: Fri, 26 Oct 2012 13:43:14 -0700 Subject: cocoa: avoid dividing by zero when setting vertical scroll position --- cocoa/ScintillaCocoa.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]; } -- cgit v1.2.3