Skip to content

Commit 0c9108e

Browse files
authored
Merge pull request #1337 from pimutils/fix/color_lengths
validate color before removing alpha values
2 parents 9de3d98 + 2fad958 commit 0c9108e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

khal/ui/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,9 +1324,9 @@ def _add_calendar_colors(
13241324

13251325
# In case the color contains an alpha value, remove it for urwid.
13261326
# eg '#RRGGBBAA' -> '#RRGGBB' and '#RGBA' -> '#RGB'.
1327-
if len(color) == 9:
1327+
if color and len(color) == 9 and color[0] == '#':
13281328
color = color[0:7]
1329-
elif len(color) == 5:
1329+
elif color and len(color) == 5 and color[0] == '#':
13301330
color = color[0:4]
13311331

13321332
entry = _urwid_palette_entry(

0 commit comments

Comments
 (0)