File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -270,14 +270,17 @@ bool ParseColors(std::string colors_string, DeviceOptions *options)
270
270
/* swy: (B) no luck, try interpreting it as an hexadecimal number instead */
271
271
if (!parsed)
272
272
{
273
- const char *colorptr = color.c_str (); char *endptr = NULL ;
273
+ if (color.length () == 6 )
274
+ {
275
+ const char *colorptr = color.c_str (); char *endptr = NULL ;
274
276
275
- rgb = strtoul (colorptr, &endptr, 16 );
277
+ rgb = strtoul (colorptr, &endptr, 16 );
276
278
277
- /* swy: check that strtoul() has advanced the read pointer until the end (NULL terminator);
278
- that means it has read the whole thing */
279
- if (colorptr != endptr && endptr && *endptr == ' \0 ' )
280
- parsed = true ;
279
+ /* swy: check that strtoul() has advanced the read pointer until the end (NULL terminator);
280
+ that means it has read the whole thing */
281
+ if (colorptr != endptr && endptr && *endptr == ' \0 ' )
282
+ parsed = true ;
283
+ }
281
284
}
282
285
283
286
/* swy: we got it, save the 32-bit integer as a tuple of three RGB bytes */
You can’t perform that action at this time.
0 commit comments