changeset 3460:50d40ed6e3da

Don't dereference pointers before checking them not to be nil.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 24 May 2019 22:01:32 +0200
parents de02dae6f7a8
children b43cf476d791
files pkg/imports/wg.go
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/wg.go	Fri May 24 18:06:58 2019 +0200
+++ b/pkg/imports/wg.go	Fri May 24 22:01:32 2019 +0200
@@ -236,7 +236,8 @@
 			feedback.Info("Processing %s", code)
 
 			// We need a valid time range to identify gauge versions in DB
-			if time.Time(*dr.Enddate).Before(time.Time(*dr.Startdate)) {
+			if dr.Enddate != nil && dr.Startdate != nil &&
+				time.Time(*dr.Enddate).Before(time.Time(*dr.Startdate)) {
 				feedback.Warn("End date before start date")
 				unchanged++
 				continue