From 9eb0cca93a37613e98596deacc6d5a3aa3831e0f Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 14 May 2023 13:04:59 +0100 Subject: [PATCH] Fix #10823, Fix #10811: Order list has end marker row. (#10825) --- src/order_gui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 0721e4d677..832999c9b2 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -562,7 +562,8 @@ private: { int sel = this->vscroll->GetScrolledRowFromWidget(y, this, WID_O_ORDER_LIST, WidgetDimensions::scaled.framerect.top); if (sel == INT_MAX) return INVALID_VEH_ORDER_ID; - assert(IsInsideBS(sel, 0, vehicle->GetNumOrders())); + /* One past the orders is the 'End of Orders' line. */ + assert(IsInsideBS(sel, 0, vehicle->GetNumOrders() + 1)); return sel; }