diff --git a/rdtk/librdtk/rdtk_font.c b/rdtk/librdtk/rdtk_font.c index 3f8014e52..2d81ccdda 100644 --- a/rdtk/librdtk/rdtk_font.c +++ b/rdtk/librdtk/rdtk_font.c @@ -404,7 +404,9 @@ int rdtk_font_parse_descriptor_buffer(rdtkFont* font, BYTE* buffer, int size) } font->glyphCount = count; - font->glyphs = (rdtkGlyph*) calloc(font->glyphCount, sizeof(rdtkGlyph)); + font->glyphs = NULL; + if (count > 0) + font->glyphs = (rdtkGlyph*) calloc(font->glyphCount, sizeof(rdtkGlyph)); if (!font->glyphs) return -1;