From fe416dcb509770dbce1710358ef39fec43962d69 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 5 Jul 2018 18:08:33 -0400 Subject: ... --- include/salticidae/stream.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index 8824f97..ffb577e 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -219,8 +219,16 @@ class Blob { size_t cheap_hash() const { return *data; } void serialize(DataStream &s) const { - for (const _impl_type *ptr = data; ptr < data + _len; ptr++) - s << htole(*ptr); + if (loaded) + { + for (const _impl_type *ptr = data; ptr < data + _len; ptr++) + s << htole(*ptr); + } + else + { + for (const _impl_type *ptr = data; ptr < data + _len; ptr++) + s << htole((_impl_type)0); + } } void unserialize(DataStream &s) { @@ -230,6 +238,7 @@ class Blob { s >> x; *ptr = letoh(x); } + loaded = true; } }; -- cgit v1.2.3-70-g09d2