mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
修复TinyPinyinEngine可能的空指针问题
This commit is contained in:
parent
cca184257a
commit
99ec3bbeb4
@ -28,6 +28,7 @@
|
|||||||
* 【core 】 修复JavaSourceCompiler.addSource目录处理错误问题(issue#3425@Github)
|
* 【core 】 修复JavaSourceCompiler.addSource目录处理错误问题(issue#3425@Github)
|
||||||
* 【core 】 修复时间戳转Bean时异常问题(issue#I8NMP7@Gitee)
|
* 【core 】 修复时间戳转Bean时异常问题(issue#I8NMP7@Gitee)
|
||||||
* 【core 】 修复PostgreSQL使用upsert字段大小写问题问题(issue#I8PB4X@Gitee)
|
* 【core 】 修复PostgreSQL使用upsert字段大小写问题问题(issue#I8PB4X@Gitee)
|
||||||
|
* 【extra 】 修复TinyPinyinEngine可能的空指针问题(issue#3437@Github)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.23(2023-11-12)
|
# 5.8.23(2023-11-12)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.extra.pinyin.engine.tinypinyin;
|
package cn.hutool.extra.pinyin.engine.tinypinyin;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Opt;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.pinyin.PinyinEngine;
|
import cn.hutool.extra.pinyin.PinyinEngine;
|
||||||
import com.github.promeg.pinyinhelper.Pinyin;
|
import com.github.promeg.pinyinhelper.Pinyin;
|
||||||
|
|
||||||
@ -51,7 +53,8 @@ public class TinyPinyinEngine implements PinyinEngine {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPinyin(String str, String separator) {
|
public String getPinyin(String str, String separator) {
|
||||||
return Pinyin.toPinyin(str, separator).toLowerCase();
|
final String pinyin = Pinyin.toPinyin(str, separator);
|
||||||
|
return StrUtil.isEmpty(pinyin) ? pinyin : pinyin.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user