twpayne / go-geom

Package geom implements efficient geometry types for geospatial applications.
BSD 2-Clause "Simplified" License
852 stars 105 forks source link

encoding/*wkb: fix panic on invalid layout on empty geometries #163

Closed otan closed 4 years ago

otan commented 4 years ago

Previously, if you had geom.NewPointFlat(geom.NoLayout), and tried to cast it to a WKB or EWKB, a panic would occur instead of invalid layout for non-GeometryCollections.

This is because the g argument would become nil and hence g.Layout() would be a nil dereference. Fix that up by not reassigning g (as Empty() is now part of the interface so we don't need it dereferenced).

(this was my bad :P)