From 11bceb610280688d82960eb34cfd3cb633fd83fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Codru=C8=9B=20Constantin=20Gu=C8=99oi?= Date: Sat, 11 Mar 2017 20:12:33 +0200 Subject: [PATCH] Fixes segfaults caused by missing faces --- src/term.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/term.c b/src/term.c index 4397210965..47ac19e89f 100644 --- a/src/term.c +++ b/src/term.c @@ -1892,6 +1892,10 @@ static void turn_on_face (struct frame *f, int face_id) { struct face *face = FACE_FROM_ID (f, face_id); + + /* Guards agains NULL returned from the `FACE_FROM_ID` macro. */ + if (face == NULL) return; + unsigned long fg = face->foreground; unsigned long bg = face->background; struct tty_display_info *tty = FRAME_TTY (f); @@ -1952,6 +1956,10 @@ static void turn_off_face (struct frame *f, int face_id) { struct face *face = FACE_FROM_ID (f, face_id); + + /* Guards agains NULL returned from the `FACE_FROM_ID` macro. */ + if (face == NULL) return; + struct tty_display_info *tty = FRAME_TTY (f); eassert (face != NULL); -- 2.12.0