Mercurial > gemma
changeset 834:232f3f345cf0
Don't crash in cross profile controller if requesting a not existing survey.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 28 Sep 2018 10:13:54 +0200 |
parents | d135274a4c92 |
children | 5bb4f1e4a4e5 0b994949a4a0 |
files | pkg/controllers/cross.go |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/cross.go Fri Sep 28 09:56:01 2018 +0200 +++ b/pkg/controllers/cross.go Fri Sep 28 10:13:54 2018 +0200 @@ -3,6 +3,7 @@ import ( "context" "database/sql" + "fmt" "log" "net/http" "time" @@ -94,6 +95,16 @@ csi.Properties.Bottleneck, csi.Properties.Date.Time, conn, req.Context()) + if tree == nil { + err = JSONError{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("Cannot find survey for %s/%s.", + csi.Properties.Bottleneck, + csi.Properties.Date.Time), + } + return + } + log.Printf("loading octree took: %s\n", time.Since(start)) if err != nil { return