aboutsummaryrefslogtreecommitdiff
path: root/src/layout.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-07-11 13:08:26 +0200
committerFederico Angelilli <code@fedang.net>2024-07-11 13:08:26 +0200
commit226c6b5bf79912b657c7cb4c5a679891030fa453 (patch)
treea465033a13d4d14cb886334f154f8f7af81a3b3e /src/layout.c
parent39e0f4e90dccbfb38db14a0cd4f596c1b5006b19 (diff)
Start working on block config
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);