From bb576312cc757287062480b078764b0a2721af9a Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 8 Oct 2020 22:35:43 +0100 Subject: [PATCH] Fix bd2649c1: Division by zero when there are no vehicles --- src/group_gui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/group_gui.cpp b/src/group_gui.cpp index b860e3b114..ee10d5a74f 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -397,7 +397,7 @@ private: occupancy += v->trip_occupancy; } - uint32 occupancy_ratio = occupancy / vehicle_count; + uint32 occupancy_ratio = vehicle_count ? occupancy / vehicle_count : 0; bool ret = (this->money_this_year != this_year) || (this->money_last_year != last_year) || (occupancy_ratio != this->occupancy_ratio); this->money_this_year = this_year;