changeset 14098:6d35a3f22ae1 draft

(svn r18645) -Fix [FS#3433](r942): out-of-bounds access in the 'Start new multiplayer game' GUI
author smatz <smatz@openttd.org>
date Sun, 27 Dec 2009 13:38:08 +0000
parents e3c772e8163d
children e17e6bd1ffd0
files src/network/network_gui.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1139,8 +1139,8 @@
 		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
 			}