提交 62ff108c 编写于 作者: N niulihua

fix param check

Change-Id: I849433d02ee3c13f5939f657d4a681e1d13d4a20
上级 f1ee3e5e
......@@ -246,6 +246,9 @@ int16_t TypedText::GetTextWidth(const char* text, uint16_t length, int16_t lette
uint8_t TypedText::GetUTF8OneCharacterSize(const char* str)
{
if (str == nullptr) {
return 0;
}
if ((str[0] & 0x80) == 0) {
return 1;
} else if ((str[0] & 0xE0) == 0xC0) {
......@@ -381,4 +384,4 @@ uint32_t TypedText::GetUtf16Cnt(const char* utf8Str)
}
return len;
}
} // namespace OHOS
\ No newline at end of file
} // namespace OHOS
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册