Skip to content

Commit

Permalink
Guard against null values #42
Browse files Browse the repository at this point in the history
  • Loading branch information
johnatawnclementawn committed Oct 17, 2024
1 parent d1b37d4 commit 462ea08
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions arches_references/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ def get_display_value(self, tile, node, **kwargs):
labels = []
requested_language = kwargs.pop("language", None)
current_language = requested_language or get_language()
for item in self.get_tile_data(tile)[str(node.nodeid)]:
for label in item["labels"]:
if (
label["language_id"] == current_language
and label["valuetype_id"] == "prefLabel"
):
labels.append(label.get("value", ""))
node_data = self.get_tile_data(tile)[str(node.nodeid)]
if node_data:
for item in node_data:
for label in item["labels"]:
if (
label["language_id"] == current_language
and label["valuetype_id"] == "prefLabel"
):
labels.append(label.get("value", ""))
return ", ".join(labels)

def collects_multiple_values(self):
Expand Down

0 comments on commit 462ea08

Please sign in to comment.