aboutsummaryrefslogtreecommitdiff
path: root/src/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout.c')
-rw-r--r--src/layout.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/layout.c b/src/layout.c
index c5969fb..ce6b281 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -32,8 +32,10 @@ void layout_init(layout_t *layout, block_t *block, layout_info_t info)
layout->n_children++;
}
- layout_t *last = &layout->children[layout->n_children - 1];
- layout->width = last->x + last->width - x_offset;
+ if (layout->n_children > 0) {
+ layout_t *last = &layout->children[layout->n_children - 1];
+ layout->width = last->x + last->width - x_offset;
+ }
} else if (block->type == BLOCK_TEXT) {
layout->pl = pango_layout_new(info.context);