Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Archermmt committed Sep 26, 2023
1 parent 701eeac commit ced5128
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/contrib/msc/core/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ bool StringUtils::EndsWith(const String& src_string, const String& sub_string) {
const std::string& src_cstring = src_string;
const std::string& sub_cstring = sub_string;
int pos = src_cstring.rfind(sub_cstring);
return pos == src_cstring.size() - sub_cstring.size();
if (pos < 0) {
return false;
}
return static_cast<size_t>(pos) == src_cstring.size() - sub_cstring.size();
}

const Array<String> StringUtils::Split(const String& src_string, const String& sep) {
Expand Down

0 comments on commit ced5128

Please sign in to comment.