diff options
| author | dsugisawa-mixi <[email protected]> | 2023-06-17 19:04:17 +0900 |
|---|---|---|
| committer | dsugisawa-mixi <[email protected]> | 2023-06-17 20:04:46 +0900 |
| commit | 5e78f08a24a1f53d66be9bc2df82051fc70cdf90 (patch) | |
| tree | c7d5980568dd921e1ae955136b134249419ef0ab /examples/host/bare_api/src | |
| parent | 13bb132044e0788d93761c0bc833196f8c6c1345 (diff) | |
fix example of bare_api, check empty string
Diffstat (limited to 'examples/host/bare_api/src')
| -rw-r--r-- | examples/host/bare_api/src/main.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/host/bare_api/src/main.c b/examples/host/bare_api/src/main.c index bb7fa850e..d1ee5e9ac 100644 --- a/examples/host/bare_api/src/main.c +++ b/examples/host/bare_api/src/main.c @@ -410,6 +410,7 @@ static int _count_utf8_bytes(const uint16_t *buf, size_t len) { } static void print_utf16(uint16_t *temp_buf, size_t buf_len) { + if ((temp_buf[0] & 0xff) == 0) return; // empty size_t utf16_len = ((temp_buf[0] & 0xff) - 2) / sizeof(uint16_t); size_t utf8_len = (size_t) _count_utf8_bytes(temp_buf + 1, utf16_len); _convert_utf16le_to_utf8(temp_buf + 1, utf16_len, (uint8_t *) temp_buf, sizeof(uint16_t) * buf_len); |
