From 38bdb175cceb800087570656d37087866c1d6272 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 15 Apr 2015 21:05:42 +0300 Subject: [PATCH] Prevent divide by zero in newman ...which happened when your max power was 0 --- src/polyself.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/polyself.c b/src/polyself.c index 023b1f44a..df78a3bc4 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -300,7 +300,7 @@ newman() enmax = rounddiv((long)enmax * (long)rn1(4, 8), 10); for (i = 0; (u.ulevel = i) < newlvl; i++) enmax += newpw(); if (enmax < u.ulevel) enmax = u.ulevel; - u.uen = rounddiv((long)u.uen * (long)enmax, u.uenmax); + u.uen = rounddiv((long)u.uen * (long)enmax, ((u.uenmax < 1) ? 1 : u.uenmax)); u.uenmax = enmax; /* [should alignment record be tweaked too?] */