Skip to content

Commit 9175506

Browse files
committed
Prevent exception when trying to retrieve semantic ids
1 parent 6086a75 commit 9175506

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

capability-check/aasUtils.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,27 @@ const getChildren = (parent) => {
5454
}
5555

5656
const getSemanticIdAsSingleKey = (element) => {
57-
if (!element.semanticId) {
57+
if (!element?.semanticId) {
5858
return null;
5959
}
6060

6161
return getReferenceAsSingleKey(element.semanticId);
6262
}
6363

6464
const getSupplementarySemanticIdsAsSingleKeys = (element) => {
65-
if (!element.supplementalSemanticIds) {
65+
if (!element?.supplementalSemanticIds) {
6666
return null;
6767
}
6868

6969
return element.supplementalSemanticIds.map(id => getReferenceAsSingleKey(id));
7070
}
7171

7272
const getReferenceAsSingleKey = (reference) => {
73+
74+
if (!reference?.keys) {
75+
return null;
76+
}
77+
7378
const keys = reference.keys;
7479
return keys[keys.length - 1].value;
7580
}

0 commit comments

Comments
 (0)