Skip to content

Commit

Permalink
[FIX] ui5Framework: Don't access metadata of deduped projects
Browse files Browse the repository at this point in the history
Because they don't have any. Otherwise a
"Cannot read property 'name' of undefined" error will be thrown.

This can only occur when using the "ui5 tree --full" command without the
--dedupe option or directly via API.
  • Loading branch information
RandomByte committed Feb 22, 2021
1 parent 3e67865 commit 0255f8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/translators/ui5Framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ module.exports = {
const processedProjects = [];
while (queue.length) {
const project = queue.shift();
if (project.deduped) {
// Deduped projects have certainly already been processed
// Note: Deduped dependencies don't have any metadata or other configuration.
continue;
}
if (processedProjects.includes(project.id)) {
// projectTree must be duplicate free. A second occurrence of the same project
// is always the same object. Therefore a single processing needs to be ensured.
Expand Down
10 changes: 9 additions & 1 deletion test/lib/translators/ui5Framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,11 @@ test.serial("utils.mergeTrees: Do not abort merge if project has already been pr
}
]
},
dependencies: []
dependencies: [{
id: "test2",
deduped: true,
dependencies: []
}]
}
]
},
Expand Down Expand Up @@ -805,6 +809,10 @@ test.serial("utils.mergeTrees: Do not abort merge if project has already been pr
},
dependencies: [
{
id: "test2",
deduped: true,
dependencies: []
}, {
metadata: {
name: "lib1"
},
Expand Down

0 comments on commit 0255f8f

Please sign in to comment.