diff src/font.c @ 95958:fbdde312e09d

(font_update_drivers): Fix crash when no drivers match.
author Andreas Schwab <schwab@suse.de>
date Sun, 15 Jun 2008 10:13:24 +0000
parents 76261fd18708
children e427600f176b
line wrap: on
line diff
--- a/src/font.c	Sun Jun 15 09:43:38 2008 +0000
+++ b/src/font.c	Sun Jun 15 10:13:24 2008 +0000
@@ -3272,7 +3272,7 @@
   if (! EQ (new_drivers, Qt))
     {
       /* Re-order the driver list according to new_drivers.  */
-      struct font_driver_list **list_table, *list;
+      struct font_driver_list **list_table, **next;
       Lisp_Object tail;
       int i;
 
@@ -3290,15 +3290,13 @@
 	  list_table[i] = list;
       list_table[i] = NULL;
 
-      f->font_driver_list = list = NULL;
+      next = &f->font_driver_list;
       for (i = 0; list_table[i]; i++)
 	{
-	  if (list)
-	    list->next = list_table[i], list = list->next;
-	  else
-	    f->font_driver_list = list = list_table[i];
+	  *next = list_table[i];
+	  next = &(*next)->next;
 	}
-      list->next = NULL;
+      *next = NULL;
     }
 
   for (list = f->font_driver_list; list; list = list->next)