gtk: do not try to ellipsize if the label is None

This commit is contained in:
alfrix 2022-08-17 14:36:25 -03:00 committed by Alfredo Monclus
parent f60a878e7b
commit ea5c5afa5e

View File

@ -173,6 +173,7 @@ class KlippyGtk:
b.set_image_position(position)
b.set_always_show_image(True)
if label is not None:
try:
# Get the label object
child = b.get_children()[0].get_children()[0].get_children()[1]
@ -182,7 +183,7 @@ class KlippyGtk:
child.set_ellipsize(Pango.EllipsizeMode.END)
child.set_lines(lines)
except Exception as e:
logging.debug(f"Unable to wrap and ellipsize label: {e}")
logging.debug(f"Unable to wrap and ellipsize label: {image_name} {label} {e}")
if style is not None:
b.get_style_context().add_class(style)