From c161339d89dc11539d37b5e434091afafd01b86b Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Tue, 21 Nov 2017 09:01:20 +0100 Subject: [PATCH] mapping: check if geom is non null before calculating area --- mapping/columns.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mapping/columns.go b/mapping/columns.go index 41705a4..f6b7ace 100644 --- a/mapping/columns.go +++ b/mapping/columns.go @@ -140,6 +140,9 @@ func MakePseudoArea(columnName string, columnType ColumnType, column config.Colu } func Area(val string, elem *element.OSMElem, geom *geom.Geometry, match Match) interface{} { + if geom.Geom == nil { + return nil + } area := geom.Geom.Area() if area == 0.0 { return nil @@ -148,6 +151,9 @@ func Area(val string, elem *element.OSMElem, geom *geom.Geometry, match Match) i } func WebmercArea(val string, elem *element.OSMElem, geom *geom.Geometry, match Match) interface{} { + if geom.Geom == nil { + return nil + } area := geom.Geom.Area() if area == 0.0 { return nil