diff --git a/Source/Game/World/WorldStateManager.cs b/Source/Game/World/WorldStateManager.cs index 3211c15c0..26886ef1e 100644 --- a/Source/Game/World/WorldStateManager.cs +++ b/Source/Game/World/WorldStateManager.cs @@ -52,21 +52,24 @@ namespace Game worldState.DefaultValue = result.Read(1); string mapIds = result.Read(2); - foreach (string mapIdToken in new StringArray(mapIds, ',')) + if (!mapIds.IsEmpty()) { - if (!uint.TryParse(mapIdToken, out uint mapId)) + foreach (string mapIdToken in new StringArray(mapIds, ',')) { - Log.outError(LogFilter.Sql, $"Table `world_state` contains a world state {id} with non-integer MapID ({mapIdToken}), map ignored"); - continue; - } + if (!uint.TryParse(mapIdToken, out uint mapId)) + { + Log.outError(LogFilter.Sql, $"Table `world_state` contains a world state {id} with non-integer MapID ({mapIdToken}), map ignored"); + continue; + } - if (!CliDB.MapStorage.ContainsKey(mapId)) - { - Log.outError(LogFilter.Sql, $"Table `world_state` contains a world state {id} with invalid MapID ({mapId}), map ignored"); - continue; - } + if (!CliDB.MapStorage.ContainsKey(mapId)) + { + Log.outError(LogFilter.Sql, $"Table `world_state` contains a world state {id} with invalid MapID ({mapId}), map ignored"); + continue; + } - worldState.MapIds.Add(mapId); + worldState.MapIds.Add(mapId); + } } if (!mapIds.IsEmpty() && worldState.MapIds.Empty())