if the colour value is unusable do not assign garbage to teh option
This commit is contained in:
parent
2dec72b4d5
commit
06d87fec2b
|
@ -103,10 +103,11 @@ strtooption(const char *value, struct nsoption_s *option)
|
|||
break;
|
||||
|
||||
case OPTION_COLOUR:
|
||||
sscanf(value, "%x", &rgbcolour);
|
||||
option->value.c = (((0x000000FF & rgbcolour) << 16) |
|
||||
((0x0000FF00 & rgbcolour) << 0) |
|
||||
((0x00FF0000 & rgbcolour) >> 16));
|
||||
if (sscanf(value, "%x", &rgbcolour) == 1) {
|
||||
option->value.c = (((0x000000FF & rgbcolour) << 16) |
|
||||
((0x0000FF00 & rgbcolour) << 0) |
|
||||
((0x00FF0000 & rgbcolour) >> 16));
|
||||
}
|
||||
break;
|
||||
|
||||
case OPTION_STRING:
|
||||
|
|
Loading…
Reference in New Issue