Fixed crash in djui_unicode_get_base_char()

This commit is contained in:
David Joslin 2023-11-08 13:00:57 -08:00 committed by Agent X
parent 522d7c0373
commit d0e6b7a1f6
1 changed files with 1 additions and 0 deletions

View File

@ -365,6 +365,7 @@ void djui_unicode_cleanup_end(char* text) {
char djui_unicode_get_base_char(char* text) {
if ((u8)*text < ' ') { return '?'; }
if ((u8)*text < 128) { return *text; }
if (!sCharMap) { return '?'; }
u64 key = convert_unicode_char_to_u64(text);
struct SmCodeGlyph* glyph = hmap_get(sCharMap, key);
return (glyph != NULL || ((u8)glyph->base < (u8)'!')) ? glyph->base : '?';