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

Calling map.getLayoutProperty will throw an undefined error when layer doesn't exist #7537

Closed
donnyv opened this issue Nov 1, 2018 · 1 comment
Labels

Comments

@donnyv
Copy link

donnyv commented Nov 1, 2018

Motivation

Calling map.getLayoutProperty should not throw an undefined error when layer name doesn't exist.

Design Alternatives

It should return null.

Design

I thought I was having issues with my map object because an undefined error was being thrown.

Implementation

javascript

I was using version 0.50.0

@donnyv donnyv changed the title Calling map.getLayoutProperty will throw an undefined error when layer doesn't exists Calling map.getLayoutProperty will throw an undefined error when layer doesn't exist Nov 1, 2018
@ryanhamley
Copy link
Contributor

Thanks for reporting this @donnyv getLayoutProperty definitely shouldn't crash the map in this situation. setLayoutProperty handles this exact situation by throwing a non-fatal error warning that the layer doesn't exist so I submitted a PR to allow getLayoutProperty to do the same thing. The call to getLayoutProperty will then return undefined.

@donnyv donnyv closed this as completed Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants