static int
fontset_compare_rfontdef (const void *val1, const void *val2)
{
- return (RFONT_DEF_SCORE (*(Lisp_Object *) val1)
- - RFONT_DEF_SCORE (*(Lisp_Object *) val2));
+ Lisp_Object v1 = *(Lisp_Object *) val1, v2 = *(Lisp_Object *) val2;
+ if (NILP (v1) && NILP (v2))
+ return 0;
+ else if (NILP (v1))
+ return INT_MIN;
+ else if (NILP (v2))
+ return INT_MAX;
+ return (RFONT_DEF_SCORE (v1) - RFONT_DEF_SCORE (v2));
}
/* Update a cons cell which has this form:
for (i = 0; i < size; i++)
{
Lisp_Object rfont_def = AREF (vec, i);
+ if (NILP (rfont_def))
+ continue;
Lisp_Object font_def = RFONT_DEF_FONT_DEF (rfont_def);
Lisp_Object font_spec = FONT_DEF_SPEC (font_def);
int score = RFONT_DEF_SCORE (rfont_def) & 0xFF;