From 58ee7d86a6f5c146f2fa0cf873f2f450e396315c Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 15 Oct 2002 17:41:22 +0000 Subject: [PATCH] If we can't load the specified font, give an error message rather than segfaulting. [originally from svn r2074] --- unix/pterm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unix/pterm.c b/unix/pterm.c index 6406c925..b59c27c8 100644 --- a/unix/pterm.c +++ b/unix/pterm.c @@ -1540,6 +1540,10 @@ int main(int argc, char **argv) } inst->fonts[0] = gdk_font_load(cfg.font); + if (!inst->fonts[0]) { + fprintf(stderr, "pterm: unable to load font \"%s\"\n", cfg.font); + exit(1); + } inst->fonts[1] = NULL; /* FIXME: what about bold font? */ inst->font_width = gdk_char_width(inst->fonts[0], ' '); inst->font_height = inst->fonts[0]->ascent + inst->fonts[0]->descent;