mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复TinyPinyinEngine可能的空指针问题
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user