changeset 97502:dc43c2f1d2fc

(lookup_derived_face): Properly handle possible zero return value of get_lface_attributes. (merge_faces): Don't tell lookup_derived_face to signal an error if face is not found.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 15 Aug 2008 21:32:48 +0000
parents 46d2c5d06bf4
children 637f86766f8a
files src/xfaces.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfaces.c	Fri Aug 15 21:32:01 2008 +0000
+++ b/src/xfaces.c	Fri Aug 15 21:32:48 2008 +0000
@@ -4974,7 +4974,9 @@
   if (!default_face)
     abort ();
 
-  get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0);
+  if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
+    return -1;
+
   bcopy (default_face->lface, attrs, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
   return lookup_face (f, attrs);
@@ -6533,10 +6535,10 @@
       if (face_id < 0 || face_id >= lface_id_to_name_size)
 	return base_face_id;
       face_name = lface_id_to_name[face_id];
-      face_id = lookup_derived_face (f, face_name, base_face_id, 1);
-      if (face_id >= 0)
-	return face_id;
-      return base_face_id;
+      /* When called during make-frame, lookup_derived_face may fail
+	 if the faces are uninitialized.  Don't signal an error.  */
+      face_id = lookup_derived_face (f, face_name, base_face_id, 0);
+      return (face_id >= 0 ? face_id : base_face_id);
     }
 
   /* Begin with attributes from the base face.  */