diff --git a/src/contrib/msc/core/utils.cc b/src/contrib/msc/core/utils.cc index 38f355bfe2b10..66f26bd1ebeea 100644 --- a/src/contrib/msc/core/utils.cc +++ b/src/contrib/msc/core/utils.cc @@ -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(pos) == src_cstring.size() - sub_cstring.size(); } const Array StringUtils::Split(const String& src_string, const String& sep) {