From c12689ce066a7abfe742f9eff7d8480b76d86f72 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 12 Feb 2026 10:06:42 +0000
Subject: [PATCH 1/2] Initial plan
From 3c0b534e679d672fbc2276c94d4ed9d109bbfbd2 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 12 Feb 2026 10:11:30 +0000
Subject: [PATCH 2/2] Add hz parameter validation to prevent divide-by-zero
errors
Co-authored-by: codegefluester <203914+codegefluester@users.noreply.github.com>
---
GamesDat/Telemetry/Sources/WarThunder/WarThunderSources.cs | 6 ++++++
1 file changed, 6 insertions(+)
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);
}