(SBT font driver) Check first if font files exist before

we try to open them
This commit is contained in:
Twinaphex 2019-08-24 03:30:32 +02:00
parent 0dc73f2c8e
commit 714e3ddc2a
3 changed files with 2 additions and 4 deletions

View file

@ -151,7 +151,7 @@ static void *font_renderer_stb_init(const char *font_path, float font_size)
if (!self)
goto error;
if (!filestream_read_file(font_path, (void**)&font_data, NULL))
if (!path_is_valid(font_path) || !filestream_read_file(font_path, (void**)&font_data, NULL))
goto error;
if (!font_renderer_stb_create_atlas(self, font_data, font_size, 512, 512))

View file

@ -245,7 +245,7 @@ static void *font_renderer_stb_unicode_init(const char *font_path, float font_si
}
else
#endif
if (!filestream_read_file(font_path, (void**)&self->font_data, NULL))
if (!path_is_valid(font_path) || !filestream_read_file(font_path, (void**)&self->font_data, NULL))
goto error;
if (!stbtt_InitFont(&self->info, self->font_data,

View file

@ -687,13 +687,11 @@ char *video_shader_read_reference_path(const char *path)
* which we will load as config_file_new_from_path_to_string(<path to config>).
*/
char *reference = NULL;
config_file_t *conf = NULL;
RFILE *file = NULL;
char *line = NULL;
if (string_is_empty(path))
goto end;
if (!path_is_valid(path))
goto end;