Skip to content

Commit

Permalink
TTITANIC: Guard against TTstring items being self-assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 19, 2017
1 parent 0c6b15d commit 4cfbe02
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions engines/titanic/true_talk/tt_string.cpp
Expand Up @@ -55,6 +55,10 @@ TTstring::~TTstring() {
}

void TTstring::operator=(const TTstring &str) {
if (&str == this)
// Trying to assign string to itself
return;

// Delete old string reference, if any
if (_data && --_data->_referenceCount == 0)
delete _data;
Expand Down

0 comments on commit 4cfbe02

Please sign in to comment.