summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--order_gui.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/order_gui.c b/order_gui.c
index 9cba6e291..df4db8f19 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -458,11 +458,12 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
case WE_RCLICK: {
Vehicle *v = GetVehicle(w->window_number);
- if (e->click.widget != 8) break;
- if (GetVehicleOrder(v, OrderGetSel(w))->type == OT_GOTO_DEPOT)
- GuiShowTooltips(STR_SERVICE_HINT);
- else
+ int sel = OrderGetSel(w);
+ if (e->click.widget != 8) break;
+ if (sel == v->num_orders || GetVehicleOrder(v, sel)->type != OT_GOTO_DEPOT)
GuiShowTooltips(STR_8857_MAKE_THE_HIGHLIGHTED_ORDER);
+ else
+ GuiShowTooltips(STR_SERVICE_HINT);
} break;
case WE_4: {