ref: ab23fc1f6565fff715163acc6e5db0584ddd3536
parent: c223c57a8b7d86b7e89f74fe3c4b8a5d6af754d1
author: Ali Gholami Rudi <ali@rudi.ir>
date: Tue Jul 30 12:03:32 EDT 2013
font: ignore nonexistent fonts in font_open()
--- a/font.c
+++ b/font.c
@@ -161,11 +161,14 @@
struct font *font_open(char *path)
{
- struct font *fn = malloc(sizeof(*fn));
+ struct font *fn;
char tok[ILNLEN];
FILE *fin;
int i;
fin = fopen(path, "r");
+ if (!fin)
+ return NULL;
+ fn = malloc(sizeof(*fn));
memset(fn, 0, sizeof(*fn));
for (i = 0; i < LEN(fn->head); i++)
fn->head[i] = -1;