Skip to content

Commit

Permalink
Avoid divide by zero in vehicle::print_fuel_indicator
Browse files Browse the repository at this point in the history
Cap can be zero on wrecks, so it's important we check for it.

Fixes #64407
  • Loading branch information
pjf committed Mar 20, 2023
1 parent b738ae2 commit 08004fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vehicle_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void vehicle::print_fuel_indicator( const catacurses::window &win, const point &
rate += power_to_energy_bat( net_battery_charge_rate( /* include_reactors = */ true ), 1_hours );
units = _( "kJ" );
}
if( rate != 0 ) {
if( rate != 0 && cap != 0 ) {
int tank_use = 0;
nc_color tank_color = c_light_green;
std::string tank_goal = _( "full" );
Expand Down

0 comments on commit 08004fc

Please sign in to comment.