Skip to content

Commit

Permalink
Prevent tool from crashing if the classification is missing attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarvarela committed Sep 14, 2023
1 parent e5dd230 commit 1424355
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ const ToolPage = (props) => {
};

for (const classification of data.classifications) {
const json = classification.attributes.find(
(a) => a.short_name == attribute.short_name
).value_json;
const item = classification.attributes.find((a) => a.short_name == attribute.short_name);

const value = JSON.parse(json);
if (item) {
const value = JSON.parse(item.value_json);

row[classification.namespace] = value;
row[classification.namespace] = value;
} else {
row[classification.namespace] = null;
}
}

rows.push(row);
Expand Down

0 comments on commit 1424355

Please sign in to comment.