diff --git a/gfx/drivers_font_renderer/coretext.c b/gfx/drivers_font_renderer/coretext.c index 33a321b97e..93efb1ae2e 100644 --- a/gfx/drivers_font_renderer/coretext.c +++ b/gfx/drivers_font_renderer/coretext.c @@ -262,13 +262,14 @@ static void *font_renderer_ct_init(const char *font_path, float font_size) ct_font_renderer_t *handle = (ct_font_renderer_t*) calloc(1, sizeof(*handle)); - if (!handle) + if (!handle || !string_is_valid(font_path)) { err = 1; goto error; } - cf_font_path = CFStringCreateWithCString(NULL, font_path, kCFStringEncodingASCII); + cf_font_path = CFStringCreateWithCString( + NULL, font_path, kCFStringEncodingASCII); if (!cf_font_path) { @@ -276,10 +277,11 @@ static void *font_renderer_ct_init(const char *font_path, float font_size) goto error; } - url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cf_font_path, kCFURLPOSIXPathStyle, false); + url = CFURLCreateWithFileSystemPath( + kCFAllocatorDefault, cf_font_path, kCFURLPOSIXPathStyle, false); dataProvider = CGDataProviderCreateWithURL(url); - theCGFont = CGFontCreateWithDataProvider(dataProvider); - face = CTFontCreateWithGraphicsFont(theCGFont, font_size, NULL, NULL); + theCGFont = CGFontCreateWithDataProvider(dataProvider); + face = CTFontCreateWithGraphicsFont(theCGFont, font_size, NULL, NULL); if (!face) {