Skip to content

Commit 38852de

Browse files
committed
handle empty response (rfcpcount % batchsize == 0)
1 parent 2e5f600 commit 38852de

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ommstats/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,16 @@ private async Task AddRfpStatsAsync(Dictionary<string, double> target, Cancellat
188188
{
189189
var group = escaper.Escape(statName.Group);
190190
var metric = escaper.Escape(statName.Name);
191+
if (rfpStats.Data == null) continue;
191192
foreach (var rfp in rfpStats.Data)
192193
{
193194
var value = rfp.Values[statName.Id];
194195
target.Add($"omm.rfpstats.{group}.{metric}.{rfp.Id}", value);
195196
}
196197
}
197-
id = rfpStats.Data.Max(x => x.Id) + 1;
198-
} while (rfpStats.Data.Length == count);
198+
if (rfpStats.Data != null)
199+
id = rfpStats.Data.Max(x => x.Id) + 1;
200+
} while (rfpStats.Data != null && rfpStats.Data.Length == count);
199201
}
200202

201203
protected virtual void Dispose(bool disposing)

0 commit comments

Comments
 (0)