add try except for icons that do not have fill

This commit is contained in:
WorldTeacher
2024-07-29 10:29:51 +02:00
parent a088c723fb
commit 0f0bcd48ba

View File

@@ -67,8 +67,12 @@ class Icon:
with open(icon_path, "rb") as file:
icon = file.read()
cicon = str(icon)
fill = re.search(r"fill=\"(.*?)\"", cicon).group(1)
icon = icon.replace(fill.encode(), config.color.encode())
try:
fill = re.search(r"fill=\"(.*?)\"", cicon).group(1)
except AttributeError:
fill = None
if fill:
icon = icon.replace(fill.encode(), config.color.encode())
return icon