diff --git a/src/ConfigCache.cs b/src/ConfigCache.cs index 00ee6d0..9b75656 100644 --- a/src/ConfigCache.cs +++ b/src/ConfigCache.cs @@ -1,3 +1,4 @@ +using System; using Microsoft.Extensions.Configuration; using System.Collections.Generic; @@ -21,11 +22,17 @@ public ConfigCache(IConfiguration configuration) { Debug = tempDebug; } - foreach(string endpoint in configuration["CSGO_ApiEndpointsToCall"].Split(';')) + foreach(string endpoint in configuration["CSGO_ApiEndpointsToCall"].Split(';', StringSplitOptions.RemoveEmptyEntries)) { ApiEndpointsToCall.Add(endpoint); } - foreach (string server in configuration["CSGO_ServersToReactTo"].Split(';')) + + if (ApiEndpointsToCall.Count == 0) + { + throw new ArgumentException("Environment variable CSGO_ApiEndpointsToCall cannot be empty"); + } + + foreach (string server in configuration["CSGO_ServersToReactTo"].Split(';', StringSplitOptions.RemoveEmptyEntries)) { ServersFilter.Add(server); }