From 6f020aef5ac8a82eb8e3e9960cf33230d3828529 Mon Sep 17 00:00:00 2001 From: F5 Date: Thu, 2 Nov 2023 12:32:17 +0800 Subject: [PATCH] mtp: Fix index out-of-bound if no links are in the simulated topology --- src/mtp/model/multithreaded-simulator-impl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mtp/model/multithreaded-simulator-impl.cc b/src/mtp/model/multithreaded-simulator-impl.cc index 863149e48..64658d455 100644 --- a/src/mtp/model/multithreaded-simulator-impl.cc +++ b/src/mtp/model/multithreaded-simulator-impl.cc @@ -299,7 +299,11 @@ MultithreadedSimulatorImpl::Partition () } } std::sort (delays.begin (), delays.end ()); - if (delays.size () % 2 == 1) + if (delays.size () == 0) + { + m_minLookahead = TimeStep (0); + } + else if (delays.size () % 2 == 1) { m_minLookahead = delays[delays.size () / 2]; }