Clamp runtime to be non-zero in FlowMapper::Run

This commit is contained in:
Jonathan G Rennison
2023-07-30 11:04:42 +01:00
parent ee6481aadc
commit c263d941da

View File

@@ -53,7 +53,7 @@ void FlowMapper::Run(LinkGraphJob &job) const
/* Scale by time the graph has been running without being compressed. Add 1 to avoid /* Scale by time the graph has been running without being compressed. Add 1 to avoid
* division by 0 if spawn date == last compression date. This matches * division by 0 if spawn date == last compression date. This matches
* LinkGraph::Monthly(). */ * LinkGraph::Monthly(). */
uint runtime = ClampTo<uint>(DateTicksToScaledDateTicks(job.StartDateTicks()) - job.LastCompression() + 1); uint runtime = (uint)Clamp<DateTicksScaled>(DateTicksToScaledDateTicks(job.StartDateTicks()) - job.LastCompression() + 1, 1, UINT32_MAX);
for (auto &it : flows) { for (auto &it : flows) {
it.ScaleToMonthly(runtime); it.ScaleToMonthly(runtime);
} }