From c2b79cd822b3ba19916a1d14c7dcc83f781220b7 Mon Sep 17 00:00:00 2001 From: Dollan Date: Thu, 11 Apr 2024 22:44:49 +0200 Subject: [PATCH] fix: no longer fails if there are no groups assigned --- Events.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Events.cs b/Events.cs index 24272d2..f4a7fd5 100644 --- a/Events.cs +++ b/Events.cs @@ -392,11 +392,18 @@ public partial class CS2_SimpleAdmin new { address }); ServerId = serverId; - GroupIds = groupIds?.Split(',').Select(int.Parse).ToArray(); + if (groupIds != null && groupIds.Length > 0) + { + GroupIds = groupIds?.Split(',').Select(int.Parse).ToArray(); + } + // For testing only _logger?.LogInformation($"Server ID: {ServerId}"); - _logger?.LogInformation($"Group IDs: {string.Join(", ", GroupIds ?? Array.Empty())}"); + if (GroupIds != null) + { + _logger?.LogInformation($"Group IDs: {string.Join(", ", GroupIds)}"); + } } catch (Exception ex)