fix shard status nullrefs
This commit is contained in:
		@@ -285,12 +285,14 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
        {
 | 
			
		||||
            if (--page < 0)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            var status = string.Join(", ", _bot.ShardCoord.Statuses.GroupBy(x => x.ConnectionState)
 | 
			
		||||
            var statuses = _bot.ShardCoord.Statuses.ToArray();
 | 
			
		||||
            var status = string.Join(", ", statuses
 | 
			
		||||
                .Where(x => x != null)
 | 
			
		||||
                .GroupBy(x => x.ConnectionState)
 | 
			
		||||
                .Select(x => $"{x.Count()} {x.Key}")
 | 
			
		||||
                .ToArray());
 | 
			
		||||
 | 
			
		||||
            var allShardStrings = _bot.ShardCoord.Statuses
 | 
			
		||||
            var allShardStrings = statuses
 | 
			
		||||
                .Select(x =>
 | 
			
		||||
                    GetText("shard_stats_txt", x.ShardId.ToString(),
 | 
			
		||||
                        Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString())))
 | 
			
		||||
 
 | 
			
		||||
@@ -65,22 +65,30 @@ namespace NadekoBot
 | 
			
		||||
            }
 | 
			
		||||
            await Task.Run(() =>
 | 
			
		||||
            {
 | 
			
		||||
                string input;
 | 
			
		||||
                while ((input = Console.ReadLine()?.ToLowerInvariant()) != "quit")
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    switch (input)
 | 
			
		||||
                    string input;
 | 
			
		||||
                    while ((input = Console.ReadLine()?.ToLowerInvariant()) != "quit")
 | 
			
		||||
                    {
 | 
			
		||||
                        case "ls":
 | 
			
		||||
                            var groupStr = string.Join(",", Statuses
 | 
			
		||||
                                .Where(x => x != null)
 | 
			
		||||
                                .GroupBy(x => x.ConnectionState)
 | 
			
		||||
                                .Select(x => x.Count() + " " + x.Key));
 | 
			
		||||
                            _log.Info(string.Join("\n", Statuses.Select(x => $"Shard {x.ShardId} is in {x.ConnectionState.ToString()} state with {x.Guilds} servers")) + "\n" + groupStr);
 | 
			
		||||
                            break;
 | 
			
		||||
                        default:
 | 
			
		||||
                            break;
 | 
			
		||||
                        switch (input)
 | 
			
		||||
                        {
 | 
			
		||||
                            case "ls":
 | 
			
		||||
                                var groupStr = string.Join(",", Statuses
 | 
			
		||||
                                    .ToArray()
 | 
			
		||||
                                    .Where(x => x != null)
 | 
			
		||||
                                    .GroupBy(x => x.ConnectionState)
 | 
			
		||||
                                    .Select(x => x.Count() + " " + x.Key));
 | 
			
		||||
                                _log.Info(string.Join("\n", Statuses.Select(x => $"Shard {x.ShardId} is in {x.ConnectionState.ToString()} state with {x.Guilds} servers")) + "\n" + groupStr);
 | 
			
		||||
                                break;
 | 
			
		||||
                            default:
 | 
			
		||||
                                break;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception ex)
 | 
			
		||||
                {
 | 
			
		||||
                    _log.Warn(ex);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            foreach (var p in ShardProcesses)
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user