changeset 106350:08b3f5b6e96d

(font_load_for_lface, font_open_by_name): Don't store name if entity is Qnil.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Tue, 01 Dec 2009 09:07:26 +0000
parents a7a4dea5246e
children 18901807a354
files src/font.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/font.c	Tue Dec 01 07:51:02 2009 +0000
+++ b/src/font.c	Tue Dec 01 09:07:26 2009 +0000
@@ -3537,8 +3537,11 @@
      it to re-apply the font when font parameters (like hinting or dpi) have
      changed.  */
   entity = font_open_for_lface (f, entity, attrs, spec);
-  name = Ffont_get (spec, QCname);
-  if (STRINGP (name)) font_put_extra (entity, QCname, name);
+  if (!NILP (entity))
+    {
+      name = Ffont_get (spec, QCname);
+      if (STRINGP (name)) font_put_extra (entity, QCname, name);
+    }
   return entity;
 }
 
@@ -3610,7 +3613,8 @@
   spec = Ffont_spec (2, args);
   ret = font_open_by_spec (f, spec);
   /* Do not loose name originally put in.  */
-  font_put_extra (ret, QCname, args[1]);
+  if (!NILP (ret))
+    font_put_extra (ret, QCname, args[1]);
 
   return ret;
 }