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

Region.clone() creates identifiers with a null string instead of null identifiers #26

Closed
matiash opened this issue Aug 26, 2014 · 1 comment

Comments

@matiash
Copy link

matiash commented Aug 26, 2014

The problem seems to be in the Region(Region otherRegion) copy constructor:

    for (int i = 0; i < otherRegion.mIdentifiers.size(); i++) {
        mIdentifiers.add(new Identifier(otherRegion.mIdentifiers.get(i)));
    }

This means that for each position that the original region had no identifier, as in the basic example:

new Region("myRangingUniqueId", null, null, null);

the cloned copy (for example, produced when calling startRangingBeaconsInRegion()) will have an Identifier with a null string instead.

A possible fix would be to change the copying loop into:

    for (int i = 0; i < otherRegion.mIdentifiers.size(); i++) {
        Identifier otherIdentifier = otherRegion.mIdentifiers.get(i);
        mIdentifiers.add(otherIdentifier != null ? new Identifier(otherIdentifier) : null);
    }
davidgyoung added a commit that referenced this issue Aug 26, 2014
@davidgyoung
Copy link
Member

Fixed in e9e3f80

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

No branches or pull requests

2 participants