station_cmd.c
changeset 1774 907db1b7a445
parent 1751 009a240d035a
child 1775 548dc04d50e2
--- a/station_cmd.c	Fri May 06 22:06:40 2005 +0000
+++ b/station_cmd.c	Sat May 07 08:14:06 2005 +0000
@@ -2650,12 +2650,16 @@
 	StringID str,old_str;
 	Station *st;
 
+	if (!IsStationIndex(p1)) return CMD_ERROR;
+	st = GetStation(p1);
+
+	if (!IsValidStation(st) || !CheckOwnership(st->owner)) return CMD_ERROR;
+
 	str = AllocateNameUnique((const char*)_decode_parameters, 6);
 	if (str == 0)
 		return CMD_ERROR;
 
 	if (flags & DC_EXEC) {
-		st = GetStation(p1);
 		old_str = st->string_id;
 		st->string_id = str;
 		UpdateStationVirtCoord(st);