diff --git a/GamesDat/Telemetry/Sources/WarThunder/WarThunderSources.cs b/GamesDat/Telemetry/Sources/WarThunder/WarThunderSources.cs index 5ffda3f..1323f37 100644 --- a/GamesDat/Telemetry/Sources/WarThunder/WarThunderSources.cs +++ b/GamesDat/Telemetry/Sources/WarThunder/WarThunderSources.cs @@ -17,6 +17,9 @@ public static class WarThunderSources /// A configured StateSource instance. public static StateSource CreateStateSource(string? baseUrl = null, int hz = 60) { + if (hz <= 0) + throw new ArgumentOutOfRangeException(nameof(hz), hz, "Polling frequency must be greater than 0"); + var pollInterval = TimeSpan.FromMilliseconds(1000.0 / hz); return new StateSource(baseUrl ?? DefaultBaseUrl, pollInterval); } @@ -39,6 +42,9 @@ public static StateSource CreateStateSource(HttpPollingSourceOptions options) /// A configured IndicatorsSource instance. public static IndicatorsSource CreateIndicatorsSource(string? baseUrl = null, int hz = 10) { + if (hz <= 0) + throw new ArgumentOutOfRangeException(nameof(hz), hz, "Polling frequency must be greater than 0"); + var pollInterval = TimeSpan.FromMilliseconds(1000.0 / hz); return new IndicatorsSource(baseUrl ?? DefaultBaseUrl, pollInterval); }