Floating point exception in Food overlay map

Issue #140 resolved
b606 created an issue

Go to food overlay map and hover the mouse on some empty houses...

Program received signal SIGFPE, Arithmetic exception.
0x0000000000a48b23 in gfx::LayerFood::handleEvent (this=0x31e05e0, event=...) 
at /home/b606/git/caesaria/source/gfx/layerfood.cpp:128
(gdb)

The line 128 of that file reads:

int monthWithFood = 2 * foodQty / house->habitants().count();

and obviously crash when house->habitants().count() = 0. Somewhere else we have:

void House::_updateMorale()
    ...
    int monthWithFood = foodStoreQty / (habtnConsumeGoodQty+1);

Comments (1)

  1. Log in to comment