Skip to content

Commit 3db4ecb

Browse files
committed
Fix compilation warning
1 parent 3898522 commit 3db4ecb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dsf/mobility/RoadDynamics.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,16 @@ namespace dsf::mobility {
597597
598598
std::uniform_real_distribution<double> uniformDist{0., cumulativeProbability};
599599
auto const randValue = uniformDist(this->m_generator);
600+
Id fallbackStreetId;
600601
double accumulated = 0.0;
601602
for (const auto& [targetStreetId, probability] : transitionProbabilities) {
602603
accumulated += probability;
604+
fallbackStreetId = targetStreetId;
603605
if (randValue < accumulated) {
604606
return targetStreetId;
605607
}
606608
}
607609
// Return last one as fallback
608-
auto const fallbackStreetId = std::prev(transitionProbabilities.cend())->first;
609610
spdlog::debug(
610611
"Fallback selection for {} at {}: street {}", *pAgent, *pNode, fallbackStreetId);
611612
return fallbackStreetId;

0 commit comments

Comments
 (0)