ArmaOverthrow / Overthrow.Arma4

A dynamic and persistent revolution platform for Arma Reforger (and eventually Arma 4)
MIT License
48 stars 19 forks source link

Fix: Division by zero in OVT_TownSupportModifierSystem #60

Closed rekterakathom closed 3 months ago

rekterakathom commented 3 months ago

Make code safe from division error, even though this variable should never be zero. It's a practically zero-cost failsafe so why not. We'll be returning the baseValue if this triggers just to keep everything running smoothly (no change in support).

One problem with this however is that it does not fix the root cause (towns having 0 population). I've added some logging here to hopefully get clues on fixing that eventually.

The report by @CowboyPilotUSA (picture below) points to L25 and this fixes L31, but I believe the VM just pointed to a wrong line, I don't think L25 is capable of throwing a 'division by zero' error under any circumstance.

image