diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 1ee994b0eb..b2e2ec49aa 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1231,7 +1231,7 @@ void ReinitGuiAfterToggleElrail(bool disable) void SetDefaultRailGui() { - if (_local_player == PLAYER_SPECTATOR) return; + if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return; extern RailType _last_built_railtype; RailType rt = (RailType)_patches.default_rail_type;