(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
authorrubidium
Sat, 09 Sep 2006 22:15:19 +0000
changeset 4585 26566ec6643c
parent 4584 281bb38d7b36
child 4586 0e814c8f5c64
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
console_cmds.c
--- a/console_cmds.c	Sat Sep 09 08:30:12 2006 +0000
+++ b/console_cmds.c	Sat Sep 09 22:15:19 2006 +0000
@@ -164,6 +164,10 @@
 	if (argc == 2) {
 		uint32 result;
 		if (GetArgumentInteger(&result, argv[1])) {
+			if (result >= MapSize()) {
+				IConsolePrint(_icolour_err, "Tile does not exist");
+				return true;
+			}
 			ScrollMainWindowToTile((TileIndex)result);
 			return true;
 		}