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

If the server returned an empty array for a get request (valid scenario), angular-data throws an exception #225

Closed
Varada opened this issue Nov 4, 2014 · 2 comments
Assignees

Comments

@Varada
Copy link

Varada commented Nov 4, 2014

In the inject function - there is code to the effect of

            if (options.linkInverse) {
                if (DS.utils.isArray(injected) && injected.length) {
                        DS.linkInverse(definition.name, injected[0][definition.idAttribute]);
                 }
                 else {
                    DS.linkInverse(definition.name, injected[definition.idAttribute]);
                }
            }

In this scenario, the get returns an array - but its length is 0. Now the code attempts to look it up in the else clause as an object and throws exception

@jmdobry
Copy link
Member

jmdobry commented Nov 4, 2014

Good catch.

@jmdobry jmdobry self-assigned this Nov 4, 2014
jmdobry added a commit that referenced this issue Nov 4, 2014
Stable Version 1.0.0-alpha.4-0.
jmdobry added a commit to js-data/js-data that referenced this issue Nov 4, 2014
@jmdobry jmdobry added done and removed bug labels Nov 4, 2014
@jmdobry jmdobry closed this as completed Nov 4, 2014
@jmdobry
Copy link
Member

jmdobry commented Nov 4, 2014

Fixed in v1.2.1

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

No branches or pull requests

2 participants