From 6f41b121d01195cb30c72f4cc2bd49c52a9f248b Mon Sep 17 00:00:00 2001 From: vng Date: Tue, 10 Jan 2012 18:58:43 +0300 Subject: [PATCH] Fix VarSerialVector serialization for empty values. --- coding/var_serial_vector.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coding/var_serial_vector.hpp b/coding/var_serial_vector.hpp index a60478810c..f832d51baa 100644 --- a/coding/var_serial_vector.hpp +++ b/coding/var_serial_vector.hpp @@ -28,7 +28,11 @@ void WriteVarSerialVector(ItT begin, ItT end, TDstStream & dst) WriteToSink(dst, offsets[i]); for (ItT it = begin; it != end; ++it) - dst.Write(&(*it)[0], it->size() * sizeof((*it)[0])); + { + typename ItT::value_type const & v = *it; + if (!v.empty()) + dst.Write(&v[0], v.size() * sizeof(v[0])); + } } template class VarSerialVectorWriter