changeset 60764:7fd2729eec90

(progress-reporter-do-update): When `min-value' is equal to `max-value', set `percentage' to 0 and prevent division by zero.
author Juri Linkov <juri@jurta.org>
date Sun, 20 Mar 2005 20:59:14 +0000
parents 3ba8f94e9cfa
children 78fa90c2361a
files lisp/subr.el
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Sun Mar 20 20:00:20 2005 +0000
+++ b/lisp/subr.el	Sun Mar 20 20:59:14 2005 +0000
@@ -2750,7 +2750,9 @@
 	 (min-value    (aref parameters 1))
 	 (max-value    (aref parameters 2))
 	 (one-percent  (/ (- max-value min-value) 100.0))
-	 (percentage   (truncate (/ (- value min-value) one-percent)))
+	 (percentage   (if (= max-value min-value)
+			   0
+			 (truncate (/ (- value min-value) one-percent))))
 	 (update-time  (aref parameters 0))
 	 (current-time (float-time))
 	 (enough-time-passed