From fdb6592cae1d073497e8d7f6defb2478811ae13a Mon Sep 17 00:00:00 2001 From: catdotjs Date: Mon, 18 Dec 2023 16:04:43 +0200 Subject: [PATCH] Fixed all of the segmentation errors due to not formatting bigclock while bigclock in on --- src/config.c | 2 +- src/draw.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 1eaa855..36577ae 100644 --- a/src/config.c +++ b/src/config.c @@ -275,7 +275,7 @@ void config_defaults() config.asterisk = '*'; config.bg = 0; config.bigclock = false; - config.bigclock_format = "%H:%M"; + config.bigclock_format = NULL; config.blank_box = true; config.blank_password = false; config.clock = NULL; diff --git a/src/draw.c b/src/draw.c index 067ab33..709591a 100644 --- a/src/draw.c +++ b/src/draw.c @@ -240,11 +240,15 @@ void alpha_blit(struct tb_cell* buf, uint16_t x, uint16_t y, uint16_t w, uint16_ void draw_bigclock(struct term_buf* buf) { - if (!config.bigclock || strlen(config.bigclock_format)==0) + if (!config.bigclock) { return; } - + + if(config.bigclock_format==NULL){ + config.bigclock_format = "%H:%M"; + } + int bigclocklength = strlen(config.bigclock_format); int xo = (buf->width / 2) - bigclocklength * (CLOCK_W+1) / 2; int yo = (buf->height - buf->box_height) / 2 - CLOCK_H - 2;