diff options
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r-- | core/ustring.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 6a93d7789e..ab4528e495 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -65,7 +65,7 @@ bool CharString::operator<(const CharString &p_right) const { } const char *this_str = get_data(); - const char *that_str = get_data(); + const char *that_str = p_right.get_data(); while (true) { if (*that_str == 0 && *this_str == 0) @@ -96,6 +96,12 @@ const char *CharString::get_data() const { void String::copy_from(const char *p_cstr) { + if (!p_cstr) { + + resize(0); + return; + } + int len = 0; const char *ptr = p_cstr; while (*(ptr++) != 0) @@ -119,6 +125,12 @@ void String::copy_from(const char *p_cstr) { void String::copy_from(const CharType *p_cstr, int p_clip_to) { + if (!p_cstr) { + + resize(0); + return; + } + int len = 0; const CharType *ptr = p_cstr; while (*(ptr++) != 0) |