diff --git a/CHANGELOG.md b/CHANGELOG.md index ce7f576..c6f375b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.3 (11-12-2023): + +Add null check in `StreamBinaryEventsWriter.FlushAsync` to prevent NRE if there were no calls to `Put` + ## 2.0.2 (29-11-2022): StreamConsumer: added supports for recall RunAsync method after cancellation diff --git a/Vostok.Hercules.Consumers/StreamBinaryEventsWriter.cs b/Vostok.Hercules.Consumers/StreamBinaryEventsWriter.cs index 118b4b8..cf9c9eb 100644 --- a/Vostok.Hercules.Consumers/StreamBinaryEventsWriter.cs +++ b/Vostok.Hercules.Consumers/StreamBinaryEventsWriter.cs @@ -70,6 +70,9 @@ public void Put(Action buildEvent) // note (kungurtsev, 15.08.2022): do not call concurrently with Put public async Task FlushAsync() { + if (writer is null) + return; + await FlushWriter(writer); writer = ObtainEmptyWriter(); }