Prevent exceptions when `that._map` is null

`that._map` is null after the first polyline is removed from the map, so
* Add safety code before dereferencing `that._map`
* For methods added to map, get map using `this` rather than `that._map`