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

Prevent error when name is null or undefined (fixes #8804) #8832

Conversation

YonatanKra
Copy link
Contributor

fixes #8804

@cesium-concierge
Copy link

Thank you so much for the pull request @YonatanKra! I noticed this is your first pull request and I wanted to say welcome to the Cesium community!

The Pull Request Guidelines is a handy reference for making sure your PR gets accepted quickly, so make sure to skim that.

  • ❌ Missing CONTRIBUTORS.md entry.
  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@YonatanKra YonatanKra force-pushed the FIX-8804-entity-constructor-throws-on-null-name branch from b2f3735 to e938112 Compare May 9, 2020 22:38
@YonatanKra YonatanKra force-pushed the FIX-8804-entity-constructor-throws-on-null-name branch from e938112 to 6136dfe Compare May 9, 2020 23:01
@mramato
Copy link
Contributor

mramato commented May 11, 2020

Thanks for the PR @YonatanKra. I'll need to find some time to dig into this a little more to make sure the check happens in the right place. If it happens for name, I would expect it happens for some other properties as well so there might be a more central place for the check.

@YonatanKra
Copy link
Contributor Author

YonatanKra commented May 11, 2020

@mramato
It doesn't happen with other properties AFAIK: sandcastle

I looked at the properties involved.
Name is the only one that's not prefilled:

this._billboard = undefined;

The error happens because name is added in the constructor. Because it is undefined/null,

if (!defined(targetProperty) && propertyNames.indexOf(name) === -1) {
is true so it tries to addProperty("name"). Problem is, "name" in this is true - hence, it throws the error.

Actually... a better fix would be to just remove name from the Entity constructor... what do you think?

@OmarShehata OmarShehata requested a review from mramato May 11, 2020 13:58
@YonatanKra
Copy link
Contributor Author

@mramato
I took another look at the code.
I pushed a more robust solution.
I think the verification was all wrong in the Entity's merge method.
Let me know what you think.

@hpinkos
Copy link
Contributor

hpinkos commented May 29, 2020

bump @mramato

@cesium-concierge
Copy link

Thanks again for your contribution @YonatanKra!

No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy?

I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with @cesium-concierge stop. If you want me to start again, just delete the comment.

…structor-throws-on-null-name

# Conflicts:
#	CHANGES.md
#	CONTRIBUTORS.md
@mramato
Copy link
Contributor

mramato commented Jun 29, 2020

Thanks again for the PR @YonatanKra! The issue here was a little more subtle than I thought and also affected availability, so I ended up pushing both a change to sync this branch up with master as well as provide a more complete fix. I'll merge as soon as CI passes and this will go out with the release on the 1st.

@mramato mramato merged commit 9e65b32 into CesiumGS:master Jun 29, 2020
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.

Entity constructor fails when passed null or undefined name
4 participants