Skip to content

Commit 88992c4

Browse files
author
Jelle Dijkstra
committed
Fixed nil pointer exceptions in WFS mapfile generator
1 parent 6eb99d6 commit 88992c4

File tree

1 file changed

+12
-2
lines changed
  • internal/controller/mapfilegenerator

1 file changed

+12
-2
lines changed

internal/controller/mapfilegenerator/mapper.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,25 @@ func SetDebugLevel(level int) {
3939
}
4040

4141
func MapWFSToMapfileGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv1.OwnerInfo) (WFSInput, error) {
42+
var metadataID string
43+
if wfs.Spec.Service.Inspire != nil {
44+
metadataID = wfs.Spec.Service.Inspire.ServiceMetadataURL.CSW.MetadataIdentifier
45+
}
46+
47+
var extent string
48+
if wfs.Spec.Service.Bbox != nil {
49+
extent = wfs.Spec.Service.Bbox.DefaultCRS.ToExtent()
50+
}
51+
4252
input := WFSInput{
4353
BaseServiceInput: BaseServiceInput{
4454
Title: mapperutils.EscapeQuotes(wfs.Spec.Service.Title),
4555
Abstract: mapperutils.EscapeQuotes(wfs.Spec.Service.Abstract),
4656
Keywords: strings.Join(wfs.Spec.Service.Keywords, ","),
4757
OnlineResource: pdoknlv3.GetHost(true),
4858
Path: mapperutils.GetPath(wfs),
49-
MetadataID: wfs.Spec.Service.Inspire.ServiceMetadataURL.CSW.MetadataIdentifier,
50-
Extent: wfs.Spec.Service.Bbox.DefaultCRS.ToExtent(),
59+
MetadataID: metadataID,
60+
Extent: extent,
5161
NamespacePrefix: wfs.Spec.Service.Prefix,
5262
NamespaceURI: mapperutils.GetNamespaceURI(wfs.Spec.Service.Prefix, ownerInfo),
5363
AutomaticCasing: wfs.Spec.Options.AutomaticCasing,

0 commit comments

Comments
 (0)