From b5b56bd77d26139d9ada22aade16cd0bea917b54 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 8 Nov 2021 15:04:01 +0200 Subject: FontPack: Don't crash if a font file is missing --- src/fontpack.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/fontpack.c b/src/fontpack.c index 52ee93be..215469b3 100644 --- a/src/fontpack.c +++ b/src/fontpack.c @@ -410,12 +410,14 @@ void handleIniKeyValue_FontPack_(void *context, const iString *table, const iStr if (!data) { data = collect_Block(readFile_FontPack_(d, cleanPath)); } - ff = new_FontFile(); - set_String(&ff->id, fontFileId); - ff->colIndex = colIndex; - load_FontFile_(ff, data); - pushBack_ObjectList(fonts_.files, ff); /* centralized ownership */ - iRelease(ff); + if (data) { + ff = new_FontFile(); + set_String(&ff->id, fontFileId); + ff->colIndex = colIndex; + load_FontFile_(ff, data); + pushBack_ObjectList(fonts_.files, ff); /* centralized ownership */ + iRelease(ff); + } } d->loadSpec->styles[i] = ref_Object(ff); delete_String(fontFileId); -- cgit v1.2.3