mtp: Fix index out-of-bound if no links are in the simulated topology

This commit is contained in:
F5
2023-11-02 12:32:17 +08:00
parent 41cde0d0c7
commit 6f020aef5a

View File

@@ -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];
}