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

mapboxgl global check will crash #84

Closed
tmcw opened this issue Aug 16, 2016 · 1 comment
Closed

mapboxgl global check will crash #84

tmcw opened this issue Aug 16, 2016 · 1 comment

Comments

@tmcw
Copy link
Contributor

tmcw commented Aug 16, 2016

if (!mapboxgl) throw new Error('include mapboxgl before mapbox-gl-directions.js');

if (!mapboxgl) throw new Error('include mapboxgl before mapbox-gl-directions.js');

If mapboxgl is not defined, this will throw a referenceerror, not the error it looks like it'll throw. A correct check would be

if (typeof mapboxgl === 'undefined') throw new Error('include mapboxgl before mapbox-gl-directions.js');

!mapboxgl is a value check, not an existence check: referencing a non-bound name will always throw.

@tmcw
Copy link
Contributor Author

tmcw commented Aug 17, 2016

Fixed in #86

@tmcw tmcw closed this as completed Aug 17, 2016
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

1 participant