diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-11-08 15:04:01 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-11-08 15:04:01 +0200 |
commit | b5b56bd77d26139d9ada22aade16cd0bea917b54 (patch) | |
tree | ea9e13ce61bf31602497ececa1ed0f7e1f361059 | |
parent | 7364e3e52e7bed9781493aedfb7be2a338146598 (diff) |
FontPack: Don't crash if a font file is missing
-rw-r--r-- | src/fontpack.c | 14 |
1 files 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 | |||
410 | if (!data) { | 410 | if (!data) { |
411 | data = collect_Block(readFile_FontPack_(d, cleanPath)); | 411 | data = collect_Block(readFile_FontPack_(d, cleanPath)); |
412 | } | 412 | } |
413 | ff = new_FontFile(); | 413 | if (data) { |
414 | set_String(&ff->id, fontFileId); | 414 | ff = new_FontFile(); |
415 | ff->colIndex = colIndex; | 415 | set_String(&ff->id, fontFileId); |
416 | load_FontFile_(ff, data); | 416 | ff->colIndex = colIndex; |
417 | pushBack_ObjectList(fonts_.files, ff); /* centralized ownership */ | 417 | load_FontFile_(ff, data); |
418 | iRelease(ff); | 418 | pushBack_ObjectList(fonts_.files, ff); /* centralized ownership */ |
419 | iRelease(ff); | ||
420 | } | ||
419 | } | 421 | } |
420 | d->loadSpec->styles[i] = ref_Object(ff); | 422 | d->loadSpec->styles[i] = ref_Object(ff); |
421 | delete_String(fontFileId); | 423 | delete_String(fontFileId); |