r297 - trunk/scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun May 20 06:43:18 EDT 2007


Author: icculus
Date: 2007-05-20 06:43:18 -0400 (Sun, 20 May 2007)
New Revision: 297

Modified:
   trunk/scripts/mojosetup_mainline.lua
Log:
Don't let percentages overflow.


Modified: trunk/scripts/mojosetup_mainline.lua
===================================================================
--- trunk/scripts/mojosetup_mainline.lua	2007-05-20 09:12:53 UTC (rev 296)
+++ trunk/scripts/mojosetup_mainline.lua	2007-05-20 10:43:18 UTC (rev 297)
@@ -111,7 +111,14 @@
     elseif total < 0 then
         return -1
     end
-    return MojoSetup.truncatenum((current / total) * 100)
+
+    local retval = MojoSetup.truncatenum((current / total) * 100)
+    if retval > 100 then
+        retval = 100
+    elseif retval < 0 then
+        retval = 0
+    end
+    return retval
 end
 
 




More information about the mojosetup-commits mailing list