Skip to content

Commit d337b29

Browse files
label.py: Fix Label when initial text is not provided
This change addresses cases when Label class is initialized with max_glyphs instead of text. In such cases, the split function is attempted on None object instead of an empty string: File "/lib/adafruit_display_text/label.py", line 84, in __init__ AttributeError: 'NoneType' object has no attribute 'split' Fixes: #141
1 parent 5934db7 commit d337b29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_display_text/label.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(self, font, **kwargs):
7575
super().__init__(font, **kwargs)
7676

7777
max_glyphs = kwargs.get("max_glyphs", None)
78-
text = kwargs.get("text", None)
78+
text = kwargs.get("text", "")
7979

8080
if not max_glyphs and not text:
8181
raise RuntimeError("Please provide a max size, or initial text")

0 commit comments

Comments
 (0)