small fix

This commit is contained in:
Robin Müller 2020-08-24 14:47:53 +02:00
parent 1b4c4de3fa
commit 26b63d63b9

View File

@ -30,15 +30,16 @@ ReturnValue_t SerialBufferAdapter<T>::serialize(uint8_t** buffer, size_t* size,
} }
if (*size + serializedLength > maxSize) { if (*size + serializedLength > maxSize) {
return BUFFER_TOO_SHORT; return BUFFER_TOO_SHORT;
} else { }
else {
if (serializeLength) { if (serializeLength) {
SerializeAdapter::serialize(&bufferLength, buffer, size, SerializeAdapter::serialize(&bufferLength, buffer, size,
maxSize, streamEndianness); maxSize, streamEndianness);
} }
if (constBuffer != nullptr) { if (this->constBuffer != nullptr) {
memcpy(*buffer, this->constBuffer, bufferLength); memcpy(*buffer, this->constBuffer, bufferLength);
} }
else if (buffer != nullptr) { else if (this->buffer != nullptr) {
// This will propably be never reached, constBuffer should always be // This will propably be never reached, constBuffer should always be
// set if non-const buffer is set. // set if non-const buffer is set.
memcpy(*buffer, this->buffer, bufferLength); memcpy(*buffer, this->buffer, bufferLength);