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

Cannot read property x of undefined #2606

Closed
rvanbaalen opened this issue Apr 2, 2014 · 4 comments
Closed

Cannot read property x of undefined #2606

rvanbaalen opened this issue Apr 2, 2014 · 4 comments

Comments

@rvanbaalen
Copy link
Contributor

When using Leaflet in combination with Angular Leaflet Directive, this error triggers when switching back and forth between a view with Leaflet and a view without leaflet.

Digging into the source, I discovered that .setPosition is being called regardless of the fact that _getPos() returns undefined.

mourner added a commit that referenced this issue Apr 3, 2014
Fix for #2606: Cannot read property x of undefined
@mourner mourner closed this as completed Apr 3, 2014
@TheCodeDestroyer
Copy link

Actually this issue was not solved completely, I would suggest that since .setPosition is being called from numerous places that, it should handle an undefined value in itself and maybe return a console.warn if needed.

@mourner
Copy link
Member

mourner commented Mar 4, 2015

@TheCodeDestroyer did you run into this in a different use case?

@TheCodeDestroyer
Copy link

@mourner Yeah, for me it's called from _resetView and _setPos and it's undefined.

@MichalMisiaszek
Copy link

I am pretty sure I pass defined values still:
TypeError: Cannot read property 'x' of undefined at Object.o.DomUtil.getTranslateString (http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js:6:12022) at Object.o.DomUtil.setPosition (http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js:6:12269) at o.PosAnimation.o.Class.extend.stop (http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js:9:21668) at o.Map.include.setView (http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js:9:22680) at o.Map.o.Class.extend.panTo (http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js:6:20298) at dashboard_panMapTo (chrome-extension://cglcekmhahoaabjeckolnegapcjlcfpj/main.js:702:17)

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

4 participants