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
Branches
Tags
No related merge requests found
...@@ -83,7 +83,10 @@ namespace communication { ...@@ -83,7 +83,10 @@ namespace communication {
newBegin = reinterpret_cast<ElementType *>(Allocator::allocate( newSize )); 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 ); std::swap( begin_, newBegin );
if( newBegin != nullptr ) 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