Skip to content

Commit

Permalink
Fix empty filter split bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nmbro committed Oct 14, 2021
1 parent dccfbd9 commit 83f854f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ConfigCache.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;

Expand All @@ -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);
}
Expand Down

0 comments on commit 83f854f

Please sign in to comment.