Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion javascript/src/URDFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ class URDFLoader {

}

const robotNode = children.filter(c => c.nodeName === 'robot').pop();
const robotNode = children.filter(c => c.nodeName.toLowerCase() === 'robot').pop();
if (!robotNode) {

throw new Error('URDFLoader: No <robot> node found in URDF.');

}
return processRobot(robotNode);

}
Expand Down
15 changes: 15 additions & 0 deletions javascript/test/URDFLoader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,3 +642,18 @@ describe('Parsing Mimic Tags', () => {
});

});

describe('Parsing', () => {

it('should throw an error if <robot> node is missing', () => {

const loader = new URDFLoader();
expect(() => {

loader.parse('<not-a-robot></not-a-robot>');

}).toThrow('URDFLoader: No <robot> node found in URDF.');

});

});