summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-09-09 22:15:19 +0000
committerrubidium <rubidium@openttd.org>2006-09-09 22:15:19 +0000
commit07cbc4f83ae9a2715e411e249a6f36aaf079086e (patch)
treede8a2ae96faa0b56d51f3ca3093cf8f72d19acfd
parent6393850dc53e4092a44fefbccd0d267e7afbde02 (diff)
downloadopenttd-07cbc4f83ae9a2715e411e249a6f36aaf079086e.tar.xz
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
-rw-r--r--console_cmds.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/console_cmds.c b/console_cmds.c
index 45b678a72..5543ccb8d 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -164,6 +164,10 @@ DEF_CONSOLE_CMD(ConScrollToTile)
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;
}