From bef953a32cd0a8bf3dad5cbbe2798dc3ab57ac5c Mon Sep 17 00:00:00 2001 From: fonsinchen Date: Tue, 8 Apr 2014 19:28:14 +0000 Subject: (svn r26448) -Fix [FS#5970]: Avoid division by 0 when scaling flow values. --- src/station_cmd.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/station_cmd.cpp') diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 55b6fae14..d637d83c3 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -4314,9 +4314,11 @@ void FlowStat::ReleaseShare(StationID st) /** * Scale all shares from link graph's runtime to monthly values. * @param runtime Time the link graph has been running without compression. + * @pre runtime must be greater than 0 as we don't want infinite flow values. */ void FlowStat::ScaleToMonthly(uint runtime) { + assert(runtime > 0); SharesMap new_shares; uint share = 0; for (SharesMap::iterator i = this->shares.begin(); i != this->shares.end(); ++i) { -- cgit v1.2.3-54-g00ecf