vt: don't call fcft_precompose() if font is NULL

This fixes a crash when doing a partial PGO build (where we don't have
any fonts available).
This commit is contained in:
Daniel Eklöf 2024-11-02 20:11:14 +01:00
parent d3cd4ad933
commit b43f19cb50
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

8
vt.c
View file

@ -763,9 +763,11 @@ action_utf8_print(struct terminal *term, char32_t wc)
bool comb_from_primary;
bool pre_from_primary;
char32_t precomposed = fcft_precompose(
term->fonts[0], base, wc, &base_from_primary,
&comb_from_primary, &pre_from_primary);
char32_t precomposed = term->fonts[0] != NULL
? fcft_precompose(
term->fonts[0], base, wc, &base_from_primary,
&comb_from_primary, &pre_from_primary)
: (char32_t)-1;
int precomposed_width = c32width(precomposed);