From 4cfbe0291916c99b7e0141bdf4c8c8229a09289f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Sep 2017 21:29:29 -0400 Subject: TTITANIC: Guard against TTstring items being self-assigned --- engines/titanic/true_talk/tt_string.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/titanic/true_talk') 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; -- cgit v1.2.3