CID 22472 Division or modulo by zero

CID 22471 Division or modulo by zero
github issue #350
github issue #349
This commit is contained in:
Enno Rehling 2015-11-09 18:06:11 +01:00
parent 2e7a1a3ded
commit 9ff6aa0d42
1 changed files with 2 additions and 2 deletions

View File

@ -96,8 +96,8 @@ void do_markets(void)
const struct race *rc = f ? f->race : NULL;
int p = rpeasants(r);
int numlux = rc_luxury_trade(rc), numherbs = rc_herb_trade(rc);
numlux = (p + numlux - MIN_PEASANTS) / numlux;
numherbs = (p + numherbs - MIN_PEASANTS) / numherbs;
if (numlux>0) numlux = (p + numlux - MIN_PEASANTS) / numlux;
if (numherbs>0) numherbs = (p + numherbs - MIN_PEASANTS) / numherbs;
if (numlux > 0 || numherbs > 0) {
int d, nmarkets = 0;
const item_type *lux = r_luxury(r);