summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-06-13 16:53:24 +0300
committerEli Zaretskii <eliz@gnu.org>2014-06-13 16:53:24 +0300
commit4346235f61172f2c55dfbbd2b830233e005987e7 (patch)
tree442e1e7d1d75203e10e8a1002f7bb938be1cca3a /src/alloc.c
parent0071d45b616f0e533818e65cc7307fbe4bd2a282 (diff)
downloademacs-4346235f61172f2c55dfbbd2b830233e005987e7.tar.gz
Attempt to fix bug #17771 with segfault if "C-h h" is interrupted.
src/alloc.c (cleanup_vector): Don't dereference a font driver pointer if it is NULL.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 12b3d4ba165..a3f3f5478cb 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2924,9 +2924,16 @@ cleanup_vector (struct Lisp_Vector *vector)
&& ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
== FONT_OBJECT_MAX))
{
- /* Attempt to catch subtle bugs like Bug#16140. */
- eassert (valid_font_driver (((struct font *) vector)->driver));
- ((struct font *) vector)->driver->close ((struct font *) vector);
+ struct font_driver *drv = ((struct font *) vector)->driver;
+
+ /* The font driver might sometimes be NULL, e.g. if Emacs was
+ interrupted before it had time to set it up. */
+ if (drv)
+ {
+ /* Attempt to catch subtle bugs like Bug#16140. */
+ eassert (valid_font_driver (drv));
+ drv->close ((struct font *) vector);
+ }
}
}