mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
修复TinyPinyinEngine可能的空指针问题
This commit is contained in:
parent
1460902eab
commit
87df51effc
@ -12,6 +12,7 @@
|
||||
|
||||
package org.dromara.hutool.extra.pinyin.engine.tinypinyin;
|
||||
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.extra.pinyin.engine.PinyinEngine;
|
||||
import com.github.promeg.pinyinhelper.Pinyin;
|
||||
|
||||
@ -64,7 +65,8 @@ public class TinyPinyinEngine implements PinyinEngine {
|
||||
|
||||
@Override
|
||||
public String getPinyin(final String str, final 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