Fixed all of the segmentation errors due to not formatting bigclock while bigclock in on

This commit is contained in:
catdotjs 2023-12-18 16:04:43 +02:00
parent 30e08501b7
commit fdb6592cae
2 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -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;