summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2014-01-16 20:50:43 +0000
committerfonsinchen <fonsinchen@openttd.org>2014-01-16 20:50:43 +0000
commita5152be79588c9c1405f44b7299dbf615edcabdb (patch)
treef77cec4fb5082bea3b42a3a6b7968dbfd4186557 /src/order_cmd.cpp
parente3947c8019fb2259b620ed79872bdafe60cc0ed2 (diff)
downloadopenttd-a5152be79588c9c1405f44b7299dbf615edcabdb.tar.xz
(svn r26263) -Fix [FS#5865]: Don't run into infinite recursion when getting next stopping station
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index c72f0d087..eefa249e7 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -428,10 +428,10 @@ StationIDStack OrderList::GetNextStoppingStation(const Vehicle *v, const Order *
hops);
const Order *advance = this->GetNextDecisionNode(
this->GetNext(next), hops);
- if (advance == NULL) {
- next = skip_to;
- } else if (skip_to == NULL) {
- next = advance;
+ if (advance == NULL || advance == first) {
+ next = (skip_to == first) ? NULL : skip_to;
+ } else if (skip_to == NULL || skip_to == first) {
+ next = (advance == first) ? NULL : advance;
} else {
StationIDStack st1 = this->GetNextStoppingStation(v, skip_to);
StationIDStack st2 = this->GetNextStoppingStation(v, advance);