aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2017-09-18 21:29:29 -0400
committerPaul Gilbert2017-09-18 21:29:29 -0400
commit4cfbe0291916c99b7e0141bdf4c8c8229a09289f (patch)
treed2abd68c212b1f225c026e100c973ffb4d37fd4b /engines/titanic/true_talk
parent0c6b15d8d0e481dfdb71b0b370b40b9ec783781b (diff)
downloadscummvm-rg350-4cfbe0291916c99b7e0141bdf4c8c8229a09289f.tar.gz
scummvm-rg350-4cfbe0291916c99b7e0141bdf4c8c8229a09289f.tar.bz2
scummvm-rg350-4cfbe0291916c99b7e0141bdf4c8c8229a09289f.zip
TTITANIC: Guard against TTstring items being self-assigned
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/tt_string.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp
index 43910fc823..d7e4e86348 100644
--- a/engines/titanic/true_talk/tt_string.cpp
+++ b/engines/titanic/true_talk/tt_string.cpp
@@ -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;