Fixed segmentation error upon not setting bigclock_format

This commit is contained in:
catdotjs 2023-12-18 15:51:00 +02:00
parent 2d417a34f7
commit b9655a3c28
2 changed files with 4 additions and 4 deletions

View File

@ -275,7 +275,7 @@ void config_defaults()
config.asterisk = '*';
config.bg = 0;
config.bigclock = false;
config.bigclock_format = NULL;
config.bigclock_format = "%H:%M";
config.blank_box = true;
config.blank_password = false;
config.clock = NULL;

View File

@ -240,12 +240,12 @@ void alpha_blit(struct tb_cell* buf, uint16_t x, uint16_t y, uint16_t w, uint16_
void draw_bigclock(struct term_buf* buf)
{
uint32_t bigclocklength = strlen(config.bigclock_format);
if (!config.bigclock || bigclocklength == 0)
if (!config.bigclock || strlen(config.bigclock_format)==0)
{
return;
}
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;