aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/string.cpp')
-rw-r--r--engines/titanic/string.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp
index dbe0617f06..44e0e627f3 100644
--- a/engines/titanic/string.cpp
+++ b/engines/titanic/string.cpp
@@ -26,11 +26,13 @@
namespace Titanic {
CString CString::left(uint count) const {
- return (count > size()) ? *this : CString(c_str(), c_str() + count);
+ return (count > size()) ? CString() : CString(c_str(), c_str() + count);
}
CString CString::right(uint count) const {
- return (count > size()) ? *this : CString(c_str() - count, c_str());
+ int strSize = size();
+ return (count > strSize) ? CString() :
+ CString(c_str() + strSize - count, c_str() + strSize);
}
CString CString::mid(uint start, uint count) const {