Fix IndexError when using empty string in Colour.from_str

Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
This commit is contained in:
ambdroid 2023-09-03 02:41:55 -04:00 committed by GitHub
parent 7bdfd454be
commit 78ce5f2331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,6 +196,9 @@ class Colour:
The string could not be converted into a colour.
"""
if not value:
raise ValueError('unknown colour format given')
if value[0] == '#':
return parse_hex_number(value[1:])