diff --git a/api/CanMsg.h b/api/CanMsg.h index dfece0d6..eaa3f0ed 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -45,7 +45,8 @@ class CanMsg : public Printable , data_length{min(can_data_len, MAX_DATA_LENGTH)} , data{0} { - memcpy(data, can_data_ptr, data_length); + if (data_length && can_data_ptr) + memcpy(data, can_data_ptr, data_length); } CanMsg() : CanMsg(0, 0, nullptr) { } @@ -54,7 +55,8 @@ class CanMsg : public Printable { this->id = other.id; this->data_length = other.data_length; - memcpy(this->data, other.data, this->data_length); + if (this->data_length && other.data) + memcpy(this->data, other.data, this->data_length); } virtual ~CanMsg() { } @@ -65,7 +67,8 @@ class CanMsg : public Printable { this->id = other.id; this->data_length = other.data_length; - memcpy(this->data, other.data, this->data_length); + if (this->data_length && other.data) + memcpy(this->data, other.data, this->data_length); } return (*this); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy