Fix stack overflow due to excessive recursion in LinkRefresher

Clamp recursion limit to maximum of 64

See: #198
This commit is contained in:
Jonathan G Rennison
2020-10-21 17:22:24 +01:00
parent abade81e63
commit 83a128e8a9
2 changed files with 2 additions and 2 deletions

View File

@@ -542,7 +542,7 @@ VehicleOrderID OrderList::GetIndexOfOrder(const Order *order) const
*/
const Order *OrderList::GetNextDecisionNode(const Order *next, uint hops, CargoTypes &cargo_mask) const
{
if (hops > this->GetNumOrders() || next == nullptr) return nullptr;
if (hops > min<uint>(64, this->GetNumOrders()) || next == nullptr) return nullptr;
if (next->IsType(OT_CONDITIONAL)) {
if (next->GetConditionVariable() != OCV_UNCONDITIONALLY) return next;