summaryrefslogtreecommitdiffstats
path: root/generic/tclHash.c
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2003-06-24 19:56:12 (GMT)
committerdkf <dkf@noemail.net>2003-06-24 19:56:12 (GMT)
commit94d7a36abc35eacf8fd024679eb25931fff5d8b2 (patch)
treecd0d79fe92f149690056ea39961bbf825d10c7f6 /generic/tclHash.c
parent5d3443b3ec1ba4e31da24af2bc9e31b442eabaac (diff)
downloadtcl-94d7a36abc35eacf8fd024679eb25931fff5d8b2.zip
tcl-94d7a36abc35eacf8fd024679eb25931fff5d8b2.tar.gz
tcl-94d7a36abc35eacf8fd024679eb25931fff5d8b2.tar.bz2
No more div-by-zero errors. [Bug 759749]
FossilOrigin-Name: b4b5c0d088c67707857f23a5b924ee4ed773f9aa
Diffstat (limited to 'generic/tclHash.c')
-rw-r--r--generic/tclHash.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/generic/tclHash.c b/generic/tclHash.c
index 45726d9..9d63ffc 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclHash.c,v 1.12 2002/11/12 02:23:18 hobbs Exp $
+ * RCS: @(#) $Id: tclHash.c,v 1.13 2003/06/24 19:56:12 dkf Exp $
*/
#include "tclInt.h"
@@ -766,7 +766,9 @@ Tcl_HashStats(tablePtr)
overflow++;
}
tmp = j;
- average += (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;
+ if (tablePtr->numEntries != 0) {
+ average += (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;
+ }
}
/*