diff options
author | Christopher Zimmermann <madroach@gmerlin.de> | 2020-10-23 21:35:24 +0200 |
---|---|---|
committer | Christopher Zimmermann <madroach@gmerlin.de> | 2020-10-23 21:44:43 +0200 |
commit | 4d418c1602c8b939d3e5e479c44985a505ecad83 (patch) | |
tree | 747d4d0b72c1c675fa61ce509c46846e7e9fff5a | |
parent | 5727003b1df9071a2bc9a42bc0b25d7c03c8de09 (diff) |
handle empty foundry encoded as NULL
to fix a segfault
-rw-r--r-- | read.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -250,8 +250,14 @@ readFile(char *filename, FontPtr font) rc = FT_Get_BDF_Property(face, "FOUNDRY", &prop); if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { font->names[i].nid = 8; - font->names[i].size = 2 * strlen(prop.u.atom); - font->names[i].value = makeUTF16((char*)prop.u.atom); + if(prop.u.atom) { + font->names[i].size = 2 * strlen(prop.u.atom); + font->names[i].value = makeUTF16((char*)prop.u.atom); + } + else { + font->names[i].size = 0; + font->names[i].value = makeUTF16(""); + } i++; } |