From 22d2f64e9dedd788e656f99e5af7a213f1615d38 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 27 Jan 2025 13:17:21 +0100 Subject: [PATCH] Find in hash table, use correct value size --- src/SDL_ttf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c index 7e611c4d..f9ea1804 100644 --- a/src/SDL_ttf.c +++ b/src/SDL_ttf.c @@ -2967,9 +2967,12 @@ static bool Find_GlyphByIndex(TTF_Font *font, FT_UInt idx, static FT_UInt get_char_index(TTF_Font *font, Uint32 ch) { FT_UInt idx = 0; - if (!SDL_FindInHashTable(font->glyph_indices, (const void *)(uintptr_t)ch, (const void **)&idx)) { + const void *value; + if (!SDL_FindInHashTable(font->glyph_indices, (const void *)(uintptr_t)ch, &value)) { idx = FT_Get_Char_Index(font->face, ch); SDL_InsertIntoHashTable(font->glyph_indices, (const void *)(uintptr_t)ch, (const void *)(uintptr_t)idx); + } else { + idx = (FT_UInt)(uintptr_t)value; } return idx; }