From d77295ef8ee731dad6f1b8b7121be7a4c4578edd Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 12 Mar 2024 20:52:10 -0700 Subject: [PATCH] fix: guard lookups into DEFAULT_TOOL_LABELS (#168) --- format/defs.bzl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/format/defs.bzl b/format/defs.bzl index 17bb265a..715628a7 100644 --- a/format/defs.bzl +++ b/format/defs.bzl @@ -62,13 +62,14 @@ def format_multirun(name, **kwargs): lang_attribute = to_attribute_name(lang) # Logic: - # - if there's no value for this key, the user omitted it, so use our default + # - if there's no value for this key, the user omitted it, so use our default if we have one # - if there is a value, and it's False, then skip this language # (and make sure we don't eagerly reference @multitool in case it isn't defined) # - otherwise use the user-supplied value + tool_label = False if lang_attribute in kwargs.keys(): tool_label = kwargs.pop(lang_attribute) - else: + elif lang in DEFAULT_TOOL_LABELS.keys(): tool_label = Label(DEFAULT_TOOL_LABELS[lang]) if not tool_label: continue