Fixed crash in djui_unicode_get_base_char()

This commit is contained in:
MysterD 2023-11-08 13:00:57 -08:00
parent 83b14690c5
commit 4e9dd6a127
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) { char djui_unicode_get_base_char(char* text) {
if ((u8)*text < ' ') { return '?'; } if ((u8)*text < ' ') { return '?'; }
if ((u8)*text < 128) { return *text; } if ((u8)*text < 128) { return *text; }
if (!sCharMap) { return '?'; }
u64 key = convert_unicode_char_to_u64(text); u64 key = convert_unicode_char_to_u64(text);
struct SmCodeGlyph* glyph = hmap_get(sCharMap, key); struct SmCodeGlyph* glyph = hmap_get(sCharMap, key);
return (glyph != NULL || ((u8)glyph->base < (u8)'!')) ? glyph->base : '?'; return (glyph != NULL || ((u8)glyph->base < (u8)'!')) ? glyph->base : '?';