1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Don't dereference iterator in memory helpers if size == 0

This commit is contained in:
Matias Fontanini
2017-05-10 18:44:55 -07:00
parent afb6ad488c
commit f1e726f503

View File

@@ -143,6 +143,10 @@ public:
if (TINS_UNLIKELY(size_ < length)) {
throw serialization_error();
}
// VC doesn't like dereferencing empty vector's iterators so check this here
if (TINS_UNLIKELY(length == 0)) {
return;
}
std::memcpy(buffer_, &*start, length);
skip(length);
}