File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
1111### Changed
1212- Change 266 files from CRLF to LF.
13+ - Apply "rule of three" to Client copy constructor and copy assignment operator
1314
1415### Deprecated
1516
Original file line number Diff line number Diff line change @@ -13,16 +13,18 @@ class Client : public Stream {
1313 }
1414 Client (const Client &client) { // copy constructor
1515 if (this != &client) { // not a self-assignment
16- if (mGodmodeDataIn ) { // replace what we previously had
17- delete mGodmodeDataIn ; // get rid of previous value
16+ if (mGodmodeDataIn &&
17+ client.mGodmodeDataIn ) { // replace what we previously had
18+ delete mGodmodeDataIn ; // get rid of previous value
1819 mGodmodeDataIn = new String (client.mGodmodeDataIn ->c_str ());
1920 }
2021 }
2122 }
2223 Client &operator =(const Client &client) { // copy assignment operator
2324 if (this != &client) { // not a self-assignment
24- if (mGodmodeDataIn ) { // replace what we previously had
25- delete mGodmodeDataIn ; // get rid of previous value
25+ if (mGodmodeDataIn &&
26+ client.mGodmodeDataIn ) { // replace what we previously had
27+ delete mGodmodeDataIn ; // get rid of previous value
2628 mGodmodeDataIn = new String (client.mGodmodeDataIn ->c_str ());
2729 }
2830 }
You can’t perform that action at this time.
0 commit comments