changeset 853:c27ce204302b

Add safety check to avoid potential divide by zero.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 31 Mar 2011 18:10:41 +0000
parents bb582f89007a
children d44bb4c4902d
files mac/dw.m
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Thu Mar 31 18:05:42 2011 +0000
+++ b/mac/dw.m	Thu Mar 31 18:10:41 2011 +0000
@@ -5090,7 +5090,15 @@
     NSScroller *scrollbar = [sv verticalScroller];
     int rowcount = [cont rowCount];
     float currpos = [scrollbar floatValue];
-    float change = (float)rows/(float)rowcount;
+    float change; 
+    
+    /* Safety check */
+    if(rowcount < 1)
+    {
+        return;
+    }
+    
+    change = (float)rows/(float)rowcount;
     
     switch(direction)
     {