summaryrefslogtreecommitdiff
path: root/src/rail_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-15 01:38:55 +0000
committerrubidium <rubidium@openttd.org>2009-12-15 01:38:55 +0000
commit7c2a61e2107eb5bd3d680128c1eea22650f70bdf (patch)
treeac3d09b0afe8dec2634ae7ece76321adaff4a8e2 /src/rail_gui.cpp
parent619e70f94a459954b4ba1c6e41921d4d9813cb45 (diff)
downloadopenttd-7c2a61e2107eb5bd3d680128c1eea22650f70bdf.tar.xz
(svn r18508) -Fix [FS#3372]: if a rail station class had less data than capacity it would try to set a negative position
Diffstat (limited to 'src/rail_gui.cpp')
-rw-r--r--src/rail_gui.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 388a5876c..99877fd3c 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -1017,7 +1017,7 @@ public:
this->vscroll.SetCount(_railstation.station_count);
this->vscroll.SetCapacity(GB(this->GetWidget<NWidgetCore>(BRSW_NEWST_LIST)->widget_data, MAT_ROW_START, MAT_ROW_BITS));
- this->vscroll.SetPosition(Clamp(_railstation.station_type - 2, 0, this->vscroll.GetCount() - this->vscroll.GetCapacity()));
+ this->vscroll.SetPosition(Clamp(_railstation.station_type - 2, 0, max(this->vscroll.GetCount() - this->vscroll.GetCapacity(), 0)));
} else {
/* New stations are not available, so ensure the default station
* type is 'selected'. */