Fix #3987: division by zero in vehicle update

Prevent division by zero by checking the value first.
This commit is contained in:
Michał Janiszewski 2016-07-23 22:52:28 +02:00 committed by Ted John
parent 306cf2383c
commit 418eb06e66
1 changed files with 3 additions and 1 deletions

View File

@ -8476,7 +8476,9 @@ loc_6DC23A:
regs.edx = vehicle->powered_acceleration;
regs.edx <<= 1;
regs.eax *= regs.edx;
regs.eax /= regs.ebx;
if (regs.ebx != 0) {
regs.eax /= regs.ebx;
}
if (vehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_15) {
regs.eax *= 4;