[GX] Handle setting var coords to NULL
This commit is contained in:
parent
59055b5494
commit
c22176d4ba
|
@ -1560,8 +1560,8 @@ hb_font_set_var_coords_normalized (hb_font_t *font,
|
||||||
while (coords_length && !coords[coords_length - 1])
|
while (coords_length && !coords[coords_length - 1])
|
||||||
coords_length--;
|
coords_length--;
|
||||||
|
|
||||||
int *copy = (int *) calloc (coords_length, sizeof (coords[0]));
|
int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : NULL;
|
||||||
if (unlikely (!copy))
|
if (unlikely (coords_length && !copy))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (font->x_coords)
|
if (font->x_coords)
|
||||||
|
@ -1569,7 +1569,9 @@ hb_font_set_var_coords_normalized (hb_font_t *font,
|
||||||
if (font->y_coords && font->y_coords != font->x_coords)
|
if (font->y_coords && font->y_coords != font->x_coords)
|
||||||
free (font->y_coords);
|
free (font->y_coords);
|
||||||
|
|
||||||
|
if (coords_length)
|
||||||
memcpy (copy, coords, coords_length * sizeof (coords[0]));
|
memcpy (copy, coords, coords_length * sizeof (coords[0]));
|
||||||
|
|
||||||
font->x_coords = font->y_coords = copy;
|
font->x_coords = font->y_coords = copy;
|
||||||
font->num_coords = coords_length;
|
font->num_coords = coords_length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue