mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(CoreText) Check first if path is valid
This commit is contained in:
parent
8d9812985b
commit
b9d7be372f
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user