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

"Start map at my position" gives error #2532

Open
sotrajohnny opened this issue Mar 9, 2018 · 1 comment
Open

"Start map at my position" gives error #2532

sotrajohnny opened this issue Mar 9, 2018 · 1 comment

Comments

@sotrajohnny
Copy link

Expected Behavior

When enabling 'Start map at my position' the map is expected to start on my position

Current Behavior

On PC it gives the following error in internet explorer but renders the page:

SCRIPT5007: Unable to get property 'style' of undefined or null reference
map.min.js (5,42596)

On Chrome it gives the following error and leaves the map unusable:

jQuery.Deferred exception: Cannot read property 'style' of null TypeError: Cannot read property 'style' of null
    at http://mymap.com/static/e6fd1d2/dist/js/map.min.js:5:42947
    at sendBackResponse (<anonymous>:17:17)
    at <anonymous>:37:21
    at Geolocation.navigator.geolocation.getCurrentPosition (<anonymous>:44:13)
    at centerMapOnLocation (http://mymap.com/static/e6fd1d2/dist/js/map.min.js:5:42682)
    at HTMLDocument.<anonymous> (http://mymap.com/static/e6fd1d2/dist/js/map.min.js:5:56821)
    at j (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:29999)
    at k (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:30313) undefined
	
	Uncaught TypeError: Cannot read property 'style' of null
    at map.min.js:5
    at sendBackResponse (<anonymous>:17:17)
    at <anonymous>:37:21
    at Geolocation.navigator.geolocation.getCurrentPosition (<anonymous>:44:13)
    at centerMapOnLocation (map.min.js:5)
    at HTMLDocument.<anonymous> (map.min.js:5)
    at j (jquery.min.js:2)
    at k (jquery.min.js:2)
	
	Uncaught TypeError: Cannot read property '238' of undefined
    at pokemonLabel (map.min.js:5)
    at customizePokemonMarker (map.min.js:5)
    at processPokemon (map.min.js:5)
    at Object.<anonymous> (map.min.js:5)
    at Function.each (jquery.min.js:2)
    at processPokemonChunked (map.min.js:5)
    at processPokemons (map.min.js:5)
    at Object.<anonymous> (map.min.js:5)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)

Possible Solution

Steps to Reproduce (for bugs)

  1. Enable 'start map at my position'
  2. Close the page
  3. Reopen the map
  4. (2 and 3 can be omitted with a force-refresh of the page)

Context

Your Environment

  • Version used: Latest
  • Environment name and version (e.g. Python 2.7):
  • Operating System and version (desktop or mobile): Desktop
@michikrug
Copy link
Contributor

michikrug commented Mar 16, 2018

Can be probably fixed with adding the following check to ensure that the current-location element is already existing:

function centerMapOnLocation() {
    var currentLocation = document.getElementById('current-location')
    if (!currentLocation) {
        setTimeout(centerMapOnLocation, 1000)
        return
    }
    [...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants