Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): throw an error when navigate to null/undefined path #13384

Closed
wants to merge 1 commit into from

Conversation

DzmitryShylovich
Copy link
Contributor

Closes #10560

@@ -558,6 +559,15 @@ export class Router {
}
}

private validateCommands(commands: string[]): void {
for (let i = 0; i < commands.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commands.forEach(cmd, i => ...
   `... contains ${cmd} at index ${i}...`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forEach skips undefined elements

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right it would skip holes... (but not undefined els) I guess a for is better then.

@@ -558,6 +559,15 @@ export class Router {
}
}

private validateCommands(commands: string[]): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make a function outside of the class. Thanks

@vicb vicb added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews pr_state: LGTM labels Jan 5, 2017
@DzmitryShylovich DzmitryShylovich force-pushed the gh/10560 branch 2 times, most recently from 946b86b to 9165d39 Compare January 5, 2017 19:03
@vicb vicb added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 5, 2017
@vicb vicb added action: merge The PR is ready for merge by the caretaker and removed action: merge The PR is ready for merge by the caretaker labels Jan 5, 2017
@matsko
Copy link
Contributor

matsko commented Jan 10, 2017

The v4 commit is 46cb04d

@matsko matsko reopened this Jan 10, 2017
@matsko matsko closed this Jan 10, 2017
@DzmitryShylovich DzmitryShylovich deleted the gh/10560 branch January 10, 2017 00:09
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
idlechara pushed a commit to idlechara/angular that referenced this pull request Apr 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: router cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Router.navigate fails with unhelpful error if undefined is part of the path
5 participants