diff --git a/tracking/tracking_fuzz_tests/tracking_fuzz_tests.cpp b/tracking/tracking_fuzz_tests/tracking_fuzz_tests.cpp index 682823b470..b8b9ff5566 100644 --- a/tracking/tracking_fuzz_tests/tracking_fuzz_tests.cpp +++ b/tracking/tracking_fuzz_tests/tracking_fuzz_tests.cpp @@ -23,20 +23,24 @@ T PopType(std::vector & data) if (data.empty()) return t; - t = *reinterpret_cast(data.data()); - if (data.size() <= sizeof(T)) + if (data.size() < sizeof(T)) + { data.clear(); - else - data.erase(data.begin(), std::next(data.begin(), sizeof(T))); + return t; + } + t = *reinterpret_cast(data.data()); + data.erase(data.begin(), std::next(data.begin(), sizeof(T))); return t; } TrafficGPSEncoder::DataPoint PopDataPoint(std::vector & data) { - return TrafficGPSEncoder::DataPoint(PopType(data) /* timestamp */, - ms::LatLon(PopType(data), PopType(data)), - PopType(data) /* traffic */); + auto const timestamp = PopType(data); + auto const lat = PopType(data); + auto const lon = PopType(data); + auto const traffic = PopType(data); + return TrafficGPSEncoder::DataPoint(timestamp, ms::LatLon(lat, lon), traffic); } } // namespace