summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-12-27 13:38:08 +0000
committersmatz <smatz@openttd.org>2009-12-27 13:38:08 +0000
commit29e05554d77179fea485f43a0d3cbb4b9d5623fc (patch)
treece41237bc93dd368540658bd82e30d77df397ab9 /src/network
parentb0c9b2c2321a2dbbf0edb43943c6e3554fc243e0 (diff)
downloadopenttd-29e05554d77179fea485f43a0d3cbb4b9d5623fc.tar.xz
(svn r18645) -Fix [FS#3433](r942): out-of-bounds access in the 'Start new multiplayer game' GUI
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_gui.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 62378d08e..6b39c8afe 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1139,8 +1139,8 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0xD7); // black background of maps list
for (uint pos = this->vscroll.GetPosition(); pos < _fios_items.Length() + 1; pos++) {
- const FiosItem *item = _fios_items.Get(pos - 1);
- if (item == this->map || (pos == 0 && this->map == NULL)) {
+ const FiosItem *item = (pos == 0) ? NULL : _fios_items.Get(pos - 1);
+ if (item == this->map) { // this->map == NULL for first item
GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, 155); // show highlighted item with a different colour
}