- var loadState = currentRoute.run('load', currentPath);
- router.stateChange(loadState || {});
+ if (currentRoute) {
+ var loadState = currentRoute.run('load', currentPath);
+ router.stateChange(loadState || {});
+ } else {
+ console.log("Unable to match route for: " + currentPath);
+ }