Skip to content

Commit e091080

Browse files
committed
Fix copy-assignment operator.
1 parent b997cbf commit e091080

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

api/CanMsg.h

+8-7
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ class CanMsg : public Printable
5959

6060
virtual ~CanMsg() { }
6161

62-
void operator = (CanMsg const & other)
62+
CanMsg & operator = (CanMsg const & other)
6363
{
64-
if (this == &other)
65-
return;
66-
67-
this->id = other.id;
68-
this->data_length = other.data_length;
69-
memcpy(this->data, other.data, this->data_length);
64+
if (this != &other)
65+
{
66+
this->id = other.id;
67+
this->data_length = other.data_length;
68+
memcpy(this->data, other.data, this->data_length);
69+
}
70+
return (*this);
7071
}
7172

7273
virtual size_t printTo(Print & p) const override

0 commit comments

Comments
 (0)