Skip to content

Passing lat as string to L.latLngBounds causes infinite recursion #933

@kcivey

Description

@kcivey

It might be preferable for strings to work as well as numbers for creating LatLng objects (in some cases they do), but regardless they shouldn't cause infinite recursion and browser crashes, as this line does in Firefox and Safari:

var bounds = L.latLngBounds(['38.80', '-77.12'], ['38.99', '-76.91']);

Try jsFiddle here: http://jsfiddle.net/kcivey/v3VzD/

The problem is that L.LatLngBounds.extend() calls L.latLngBounds() if its argument is not either a LatLng or an array with a number as the first element. It needs to either convert strings to floats or at least give an error when a string is passed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions