font: glyph_for_wchar(): ensure glyph->valid == false, in *all* error cases

This commit is contained in:
Daniel Eklöf 2019-10-18 19:50:48 +02:00
parent 3c42691e1b
commit 6fd4f6000b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

10
font.c
View file

@ -324,6 +324,11 @@ hash_index(wchar_t wc)
static bool
glyph_for_wchar(const struct font *font, wchar_t wc, struct glyph *glyph)
{
*glyph = (struct glyph){
.wc = wc,
.valid = false,
};
/*
* LCD filter is per library instance. Thus we need to re-set it
* every time...
@ -552,10 +557,7 @@ glyph_for_wchar(const struct font *font, wchar_t wc, struct glyph *glyph)
return true;
err:
*glyph = (struct glyph){
.wc = wc,
.valid = false,
};
assert(!glyph->valid);
return false;
}