aboutsummaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-10-18 17:50:48 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-10-18 17:50:48 +0000
commit6fd4f6000b493c16c778cb1bca6c8d2d9f3ec988 (patch)
tree1a8d089561570d3a34fc18edd2d6cd87879d8e7a /font.c
parentfont: load fallback fonts on demand (diff)
font: glyph_for_wchar(): ensure glyph->valid == false, in *all* error cases
Diffstat (limited to 'font.c')
-rw-r--r--font.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/font.c b/font.c
index d19925a7..4b1be833 100644
--- a/font.c
+++ b/font.c
@@ -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;
}