From d1a975478445dd398777222bac963093e99a167e Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 8 Sep 2020 03:23:36 +0100 Subject: [PATCH] Fix uninitialised memory usage --- src/Font.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Font.cpp b/src/Font.cpp index f1a59a92..6a33b96c 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -1092,8 +1092,7 @@ FontObject* LoadFontFromData(const unsigned char *data, size_t data_size, unsign // Initialise the linked-list for (size_t i = 0; i < TOTAL_GLYPH_SLOTS; ++i) { - if (i != 0) - font_object->glyphs[i].next = &font_object->glyphs[i - 1]; + font_object->glyphs[i].next = (i == 0) ? NULL : &font_object->glyphs[i - 1]; font_object->glyphs[i].x = (i % font_object->atlas_row_length) * atlas_entry_width; font_object->glyphs[i].y = (i / font_object->atlas_row_length) * atlas_entry_height;