Skip to content
Snippets Groups Projects
Commit 190f6385 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

CustomMemoryBuffer: only memcpy when not `nullptr`

parent ba2c6619
No related merge requests found
......@@ -83,7 +83,10 @@ namespace communication {
newBegin = reinterpret_cast<ElementType *>(Allocator::allocate( newSize ));
Allocator::memcpy( newBegin, begin_, size_t(end_ - begin_) );
// memcpy: If either dest or src is an invalid or null pointer, the behavior is undefined, even if count is zero.
if(begin_) {
Allocator::memcpy( newBegin, begin_, size_t(end_ - begin_) );
}
std::swap( begin_, newBegin );
if( newBegin != nullptr )
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment