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:
@@ -143,6 +143,10 @@ public:
|
|||||||
if (TINS_UNLIKELY(size_ < length)) {
|
if (TINS_UNLIKELY(size_ < length)) {
|
||||||
throw serialization_error();
|
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);
|
std::memcpy(buffer_, &*start, length);
|
||||||
skip(length);
|
skip(length);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user