diff options
author | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2015-03-09 17:26:12 -0700 |
---|---|---|
committer | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2015-03-09 17:26:12 -0700 |
commit | 1714bc64ddb5d9646eb21c6eb6999933f37ffbfe (patch) | |
tree | a5a165bafa3135e6154c2a89476125de5270f072 | |
parent | 7d8979d9eca8e7c737fb66d9f18e2cb239700f74 (diff) |
Handle gracefull comparision with NULL strings
-rw-r--r-- | src/core/basetypes/MCString.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/basetypes/MCString.cpp b/src/core/basetypes/MCString.cpp index 213d5e5f..02c93200 100644 --- a/src/core/basetypes/MCString.cpp +++ b/src/core/basetypes/MCString.cpp @@ -1194,6 +1194,9 @@ Data * String::encodedMIMEHeaderValueForSubject() int String::compareWithCaseSensitive(String * otherString, bool caseSensitive) { + if (otherString == NULL) { + return 1; + } if ((length() == 0) && (otherString->length() == 0)) { return 0; } @@ -1206,7 +1209,7 @@ int String::compareWithCaseSensitive(String * otherString, bool caseSensitive) } if (otherString->unicodeCharacters() == NULL) { - return -1; + return 1; } #if DISABLE_ICU |