aboutsummaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'font.c')
-rw-r--r--font.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/font.c b/font.c
index a1e29be..3903698 100644
--- a/font.c
+++ b/font.c
@@ -151,8 +151,10 @@ int atlas_get_strwidth(client_state* state, const char* str) {
}
void atlas_calc_item_widths(client_state* state) {
- array_for_all(item_t, item, state->items) {
- item->pixel_len = atlas_get_strwidth(state, item->text);
- state->required_width = MAX(state->required_width, item->pixel_len + state->line_height / 2.0f);
+ if (state->items) {
+ array_for_all(item_t, item, state->items) {
+ item->pixel_len = atlas_get_strwidth(state, item->text);
+ state->required_width = MAX(state->required_width, item->pixel_len + state->line_height / 2.0f);
+ }
}
}