Conform to coding standard and errors
An error will not be printed if the parameter to `T` is not valid (- or a number) and the token will be eaten (just like when an invalid attribute is found)
This commit is contained in:
parent
49fdc25f37
commit
73d8c58286
20
lemonbar.c
20
lemonbar.c
|
@ -540,18 +540,22 @@ parse (char *text)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
if(*p == '-') { //Reset to automatic font selection
|
if (*p == '-') { //Reset to automatic font selection
|
||||||
font_index = -1;
|
font_index = -1;
|
||||||
p++;
|
p++;
|
||||||
break;
|
break;
|
||||||
}
|
} else if (isdigit(*p)) {
|
||||||
font_index = (int)strtoul(p, &ep, 10);
|
font_index = (int)strtoul(p, &ep, 10);
|
||||||
// User-specified 'font_index' ∊ (0,font_count]
|
// User-specified 'font_index' ∊ (0,font_count]
|
||||||
// Otherwise just fallback to the automatic font selection
|
// Otherwise just fallback to the automatic font selection
|
||||||
if (!font_index || font_index > font_count)
|
if (!font_index || font_index > font_count)
|
||||||
font_index = -1;
|
font_index = -1;
|
||||||
p = ep;
|
p = ep;
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Invalid font slot \"%c\"\n", *p++); //Swallow the token
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// In case of error keep parsing after the closing }
|
// In case of error keep parsing after the closing }
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user