[Addressability] Handle bad paths

Handle paths that cannot be completely followed, WTD-1149.
This commit is contained in:
Victor Woeltjen 2015-06-16 14:35:15 -07:00
parent d7b79b6b69
commit 26fd56a003

View File

@ -103,12 +103,22 @@ define(
if (composition) { if (composition) {
composition.then(function (c) { composition.then(function (c) {
var nextObject = findObject(c, path[index]); var nextObject = findObject(c, path[index]);
if (index + 1 >= path.length) { if (nextObject) {
navigateTo(nextObject); if (index + 1 >= path.length) {
navigateTo(nextObject);
} else {
doNavigate(nextObject, index + 1);
}
} else { } else {
doNavigate(nextObject, index + 1); // Couldn't find the next element of the path
// so navigate to the last path object we did find
navigateTo(domainObject);
} }
}); });
} else {
// Similar to above case; this object has no composition,
// so navigate to it instead of subsequent path elements.
navigateTo(domainObject);
} }
} }