summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-27 19:37:27 +0000
committersmatz <smatz@openttd.org>2009-05-27 19:37:27 +0000
commit5cd998b7a42ef7e6f57ac0fe5161f638d9fdf4f4 (patch)
treec42b2e0a5751c01047d0208efec2396c311529fc /src
parent4c9b4f5265ca0dffb786b890da11ed6c287ecd20 (diff)
downloadopenttd-5cd998b7a42ef7e6f57ac0fe5161f638d9fdf4f4.tar.xz
(svn r16451) -Fix (r16449): crash when a spectator (or dedicated server) received news about new engine
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index e798f7b80..2d673e86c 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1406,6 +1406,9 @@ static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, Engi
if (map == PAL_NONE) map = twocc ? (SpriteID)SPR_2CCMAP_BASE : (SpriteID)PALETTE_RECOLOUR_START;
+ /* Spectator has news shown too, but has invalid company ID - as well as dedicated server */
+ if (!Company::IsValidID(company)) return map;
+
const Livery *livery = GetEngineLivery(engine_type, company, parent_engine_type, v);
map += livery->colour1;