Check iterator for it != cfg->TimeRange.cend().

This commit is contained in:
Gerhard Hoffmann 2024-04-24 13:16:22 +02:00
parent e93b08505a
commit ea0bcde413

View File

@ -408,7 +408,10 @@ uint32_t Utilities::getMaximalParkingPrice(Configuration const *cfg, PaymentMeth
uint32_t Utilities::getTimeRangeStep(Configuration const *cfg, int step, PaymentMethod methodId) {
if (methodId == PaymentMethod::Progressive) {
return std::max((int)cfg->TimeRange.find(step)->second.time_range_to_in_minutes_from_start, 0);
Configuration::TimeRangeType::const_iterator it = cfg->TimeRange.find(step);
if (it != cfg->TimeRange.cend()) {
return std::max((int)(it->second.time_range_to_in_minutes_from_start), 0);
}
}
return 0;