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

Already on GitHub? Sign in to your account

cover null case for belongsTo relationship #564

Merged
merged 1 commit into from Jan 9, 2013

Conversation

Projects
None yet
6 participants
Contributor

jefflab commented Dec 30, 2012

I was getting an error:

TypeError: Cannot read property 'clientId' of null

The error was caused by the fact that this statement doesn't protect against a null id:

if (typeof id === 'object') {
  return store.findByClientId(type, id.clientId);
}

This pull request adds the null check, and also a test.

Contributor

ppcano commented Dec 31, 2012

Fixed the same issue for me, thanks.

Ran into this too. This commit fixes the issue.

Contributor

leepfrog commented Jan 7, 2013

👍 to the problem and solution.. thanks @jefflab

gabesmed commented Jan 9, 2013

+1

Contributor

jefflab commented Jan 9, 2013

Thanks to everyone for letting me know this worked for you.

This is my first contribution to ember, so please let me know if there is anything else I need to do before the framework team accepts this pull request.

Owner

wagenet commented Jan 9, 2013

@sandstrom I think the issue here is that typeof null === 'object'. So the old check was letting null through.

@wagenet wagenet added a commit that referenced this pull request Jan 9, 2013

@wagenet wagenet Merge pull request #564 from jefflab/null-belongsTo
cover null case for belongsTo relationship
2ee743b

@wagenet wagenet merged commit 2ee743b into emberjs:master Jan 9, 2013

1 check passed

default The Travis build passed
Details

@jefflab jefflab deleted the jefflab:null-belongsTo branch Jan 11, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment