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

TypeError: Cannot read property 'hostname' of null #321

Closed
wants to merge 6 commits into from
Closed

TypeError: Cannot read property 'hostname' of null #321

wants to merge 6 commits into from

Conversation

waitingcheung
Copy link
Contributor

I am getting a TypeError when trying to construct a new instance of URI.

TypeError: Cannot read property 'hostname' of null
    at URI.p.href (file:///path/URI-1.18.4.js:1143:52)
    at new URI (file:///path/URI-1.18.4.js:64:10)

Here is a simple test case to reproduce that

var obj = getURIObj(params) // return null when object not found
var u = new URI(obj);

It seems that line 52 handles the case when url is undefined, but it should also throw an exception for null as well.

@rodneyrehm
Copy link
Member

I don't see why not. PR welcome :)

@waitingcheung
Copy link
Contributor Author

@rodneyrehm Please let me know if the pull request looks fine to you or if you need further changes. Thank you.

@rodneyrehm
Copy link
Member

I've merged your fix locally 09fd3b5 and added the test and changelog entry in your name. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants