summaryrefslogtreecommitdiff
path: root/buildstream/_frontend
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_frontend')
-rw-r--r--buildstream/_frontend/widget.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index 8b55b39ee..e1ea4e04b 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -179,11 +179,11 @@ class ElementName(Widget):
def render(self, message):
element_id = message.task_id or message.unique_id
- if element_id is not None:
- plugin = _plugin_lookup(element_id)
- name = plugin.name
- else:
- name = ''
+ if element_id is None:
+ return ""
+
+ plugin = _plugin_lookup(element_id)
+ name = plugin.name
# Sneak the action name in with the element name
action_name = message.action_name
@@ -226,10 +226,12 @@ class CacheKey(Widget):
missing = False
key = ' ' * self.key_length
element_id = message.task_id or message.unique_id
- if element_id is not None:
- plugin = _plugin_lookup(element_id)
- if isinstance(plugin, Element):
- _, key, missing = plugin._get_full_display_key()
+ if element_id is None:
+ return ""
+
+ plugin = _plugin_lookup(element_id)
+ if isinstance(plugin, Element):
+ _, key, missing = plugin._get_full_display_key()
if message.message_type in [MessageType.FAIL, MessageType.BUG]:
text = self.err_profile.fmt(key)