{"action":"created","issue":{"url":"https://api.github.com/repos/Leaflet/Leaflet.markercluster/issues/580","labels_url":"https://api.github.com/repos/Leaflet/Leaflet.markercluster/issues/580/labels{/name}","comments_url":"https://api.github.com/repos/Leaflet/Leaflet.markercluster/issues/580/comments","events_url":"https://api.github.com/repos/Leaflet/Leaflet.markercluster/issues/580/events","html_url":"https://github.com/Leaflet/Leaflet.markercluster/issues/580","id":111838388,"number":580,"title":"Cannot read property '_icon' of undefined","user":{"login":"mfc-julius","id":7352358,"avatar_url":"https://avatars.githubusercontent.com/u/7352358?v=3","gravatar_id":"","url":"https://api.github.com/users/mfc-julius","html_url":"https://github.com/mfc-julius","followers_url":"https://api.github.com/users/mfc-julius/followers","following_url":"https://api.github.com/users/mfc-julius/following{/other_user}","gists_url":"https://api.github.com/users/mfc-julius/gists{/gist_id}","starred_url":"https://api.github.com/users/mfc-julius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfc-julius/subscriptions","organizations_url":"https://api.github.com/users/mfc-julius/orgs","repos_url":"https://api.github.com/users/mfc-julius/repos","events_url":"https://api.github.com/users/mfc-julius/events{/privacy}","received_events_url":"https://api.github.com/users/mfc-julius/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-16T14:02:40Z","updated_at":"2015-10-20T09:50:38Z","closed_at":null,"body":"I can't reproduce this bug, but I get notifications from time to time on Opbeat, when 'animationend' is fired in  L.MarkerClusterGroup.include.L.DomUtil.TRANSITION._animationEnd, and `showMarker` method tries to check `if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation)`, and apparently __parent does not exist (see StackTrace at the bottom).\r\n\r\nI'm not very familiar with Leaflet's code, but if the __parent is not always available, would it be worth checking `if ((layer._icon || (layer.__parent && layer.__parent._icon)) && !this._inZoomAnimation)`?\r\n\r\nStackTrace:\r\nL.MarkerClusterGroup.include.L.DomUtil.TRANSITION._animationEnd\r\nL.Mixin.Events.fireEvent\r\nshowMarker\r\n?"},"comment":{"url":"https://api.github.com/repos/Leaflet/Leaflet.markercluster/issues/comments/149499126","html_url":"https://github.com/Leaflet/Leaflet.markercluster/issues/580#issuecomment-149499126","issue_url":"https://api.github.com/repos/Leaflet/Leaflet.markercluster/issues/580","id":149499126,"user":{"login":"mfc-julius","id":7352358,"avatar_url":"https://avatars.githubusercontent.com/u/7352358?v=3","gravatar_id":"","url":"https://api.github.com/users/mfc-julius","html_url":"https://github.com/mfc-julius","followers_url":"https://api.github.com/users/mfc-julius/followers","following_url":"https://api.github.com/users/mfc-julius/following{/other_user}","gists_url":"https://api.github.com/users/mfc-julius/gists{/gist_id}","starred_url":"https://api.github.com/users/mfc-julius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfc-julius/subscriptions","organizations_url":"https://api.github.com/users/mfc-julius/orgs","repos_url":"https://api.github.com/users/mfc-julius/repos","events_url":"https://api.github.com/users/mfc-julius/events{/privacy}","received_events_url":"https://api.github.com/users/mfc-julius/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T09:50:38Z","updated_at":"2015-10-20T09:50:38Z","body":"Thanks for you answer.\r\n\r\nI don't really know if it might be related, because even on those issues it's not really clear what's the real issue.\r\n\r\nI use `zoomToShowLayer` in two places on my code:\r\n\r\n```\r\n// triggered manually by pressing a button \"zoom to feature\"\r\nif (child && mainLayer.getVisibleParent(child) instanceof L.MarkerCluster) {\r\n  mainLayer.zoomToShowLayer(child, function () {});\r\n}\r\n```\r\n\r\nSo this does the check you mentioned (also not the callback function I must provide, the issue was opened here: https://github.com/Leaflet/Leaflet.markercluster/issues/503).\r\n\r\nAlso:\r\n\r\n```\r\n// triggered when accessing feature to show it on the map\r\nif (child && mainLayer.getVisibleParent(child) instanceof L.MarkerCluster) {\r\n  if (layer.feature.deflated && !landingWithCenter) {\r\n    visualization.fitToLayerBounds(child);\r\n  } else if (!landingWithCenter || zoom === 19) {\r\n    leaflet.layers.mainLayer.zoomToShowLayer(child, function () {});\r\n  }\r\n}\r\n```\r\n\r\nIt might be that the feature gets removed at the same time, because I use modified https://github.com/oliverroick/Leaflet.Deflate (modification is needed for this to work with clusters). So, when the method gets called, on a feature that is inside the cluster but is actually deflated polygon or polyline, when zooming to it, at the end it will be converted from marker to the actual shape.\r\n\r\nFor checking and converting to/from created marker I use on 'zoomend', which is also used by this plugin."}}