Closed abrakadobr closed 4 years ago
diff --git a/src/SearchControl.ts b/src/SearchControl.ts
index be97a77..3874111 100644
--- a/src/SearchControl.ts
+++ b/src/SearchControl.ts
@@ -357,7 +357,7 @@ const Control: SearchControl = {
const { autoClose } = this.options;
// @ts-ignore
- const markers = Object.keys(this.markers._layers);
+ const markers = this.markers?Object.keys(this.markers._layers):[];
if (markers.length >= this.options.maxMarkers) {
// @ts-ignore
this.markers.removeLayer(markers[0]);
I am also getting the same error. Please share if you've found a solution for this.
It would be nice if someone can submit a pull-request with that patch. I can take a look at it later this week.
I had the same problem on 3.0.0 but since I updated to 3.0.5 it seems to be gone.
@rawhasan & @abrakadobr, which version do you use?
I had the same issue, but upgraded from 3.0 to 3.0.6 as @qzminski said, fixed the problem.
Thanks Sam!
I'm going to close this one. Please let me know if the issue persist, so I can reopen it.
env: libs are loaded to website with requirejs error: on clicking any search result error happens and nothing happened - map doesn't change position, no markers appear, no event 'geosearch/showlocation' triggered. this happens inside showResult method, on line 360, if "this.markers" is null or undefined (i have no idea why it is)
but this is small patch, fixing this problem, after everithing works perfect =)