summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-11-08 15:04:01 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-11-08 15:04:10 +0200
commitfdb6fa15d58142a9be3aa5e14471ef83df8caff4 (patch)
tree85698da62026c3066d29dfe4a50ff09984d410fe
parent47d2b3122ea18147c0661b0158ccf1daef2d9c2b (diff)
FontPack: Don't crash if a font file is missing
-rw-r--r--src/fontpack.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fontpack.c b/src/fontpack.c
index 40e4c96c..c12b2ddc 100644
--- a/src/fontpack.c
+++ b/src/fontpack.c
@@ -401,12 +401,14 @@ void handleIniKeyValue_FontPack_(void *context, const iString *table, const iStr
401 if (!data) { 401 if (!data) {
402 data = collect_Block(readFile_FontPack_(d, cleanPath)); 402 data = collect_Block(readFile_FontPack_(d, cleanPath));
403 } 403 }
404 ff = new_FontFile(); 404 if (data) {
405 set_String(&ff->id, fontFileId); 405 ff = new_FontFile();
406 ff->colIndex = colIndex; 406 set_String(&ff->id, fontFileId);
407 load_FontFile_(ff, data); 407 ff->colIndex = colIndex;
408 pushBack_ObjectList(fonts_.files, ff); /* centralized ownership */ 408 load_FontFile_(ff, data);
409 iRelease(ff); 409 pushBack_ObjectList(fonts_.files, ff); /* centralized ownership */
410 iRelease(ff);
411 }
410 } 412 }
411 d->loadSpec->styles[i] = ref_Object(ff); 413 d->loadSpec->styles[i] = ref_Object(ff);
412 delete_String(fontFileId); 414 delete_String(fontFileId);