提交 61df746d 编写于 作者: O openharmony_ci 提交者: Gitee

!74 增加对find返回值的判断

Merge pull request !74 from 多肉包包与旺旺肉松/OpenHarmony-3.0-LTS
......@@ -226,7 +226,10 @@ std::string LocaleInfo::Maximize()
Locale curLocale = locale;
curLocale.addLikelySubtags(status);
if (status == U_ZERO_ERROR) {
std::string restConfigs = finalLocaleTag.substr(finalLocaleTag.find("-u-"));
std::string restConfigs = "";
if (finalLocaleTag.find("-u-") != std::string::npos) {
restConfigs = finalLocaleTag.substr(finalLocaleTag.find("-u-"));
}
std::string curBaseName = (curLocale.getBaseName() == nullptr) ? "" : curLocale.getBaseName();
std::replace(curBaseName.begin(), curBaseName.end(), '_', '-');
std::string localeTag = curBaseName + restConfigs;
......@@ -241,7 +244,10 @@ std::string LocaleInfo::Minimize()
Locale curLocale = locale;
curLocale.minimizeSubtags(status);
if (status == U_ZERO_ERROR) {
std::string restConfigs = finalLocaleTag.substr(finalLocaleTag.find("-u-"));
std::string restConfigs = "";
if (finalLocaleTag.find("-u-") != std::string::npos) {
restConfigs = finalLocaleTag.substr(finalLocaleTag.find("-u-"));
}
std::string curBaseName = (curLocale.getBaseName() == nullptr) ? "" : curLocale.getBaseName();
std::replace(curBaseName.begin(), curBaseName.end(), '_', '-');
std::string localeTag = curBaseName + restConfigs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册