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

Cannot read property 'length' of null #110

Closed
geek opened this issue Oct 5, 2017 · 3 comments
Labels
bug
Milestone

Comments

@geek
Copy link
Member

@geek geek commented Oct 5, 2017

lib/index.js:263

When expect(null).to.have.length(2);

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Oct 6, 2017

Easy link

const length = this._ref.length !== undefined ? this._ref.length : Object.keys(this._ref).length;

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Oct 6, 2017

would this._ref && (this._ref.length !== undefined ? this._ref.length : Object.keys(this._ref).length) fix it?

@cjihrig

This comment has been minimized.

Copy link
Contributor

@cjihrig cjihrig commented Oct 7, 2017

@AdriVanHoudt want to submit a PR and find out 😄 ?

AdriVanHoudt added a commit to AdriVanHoudt/code that referenced this issue Oct 9, 2017
Fixes hapijs#110
@cjihrig cjihrig closed this in #111 Oct 9, 2017
cjihrig added a commit that referenced this issue Oct 9, 2017
@cjihrig cjihrig added the bug label Oct 16, 2017
@cjihrig cjihrig added this to the 5.1.1 milestone Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.