From 1aeadf4a8a0e9a77782f1df261563fe80fe7cea9 Mon Sep 17 00:00:00 2001 From: mpl Date: Tue, 24 Apr 2018 17:45:13 -0700 Subject: [PATCH] pkg/index: on slurping bogus gps coordinate, log instead of panicking If a GPS coordinate is bogus, we should have caught it when receiving the blob, and not write it out as an index row. If we did not, we end up catching it when trying to slurp it to the corpus. At this point there's no reason to penalize the user by panicking, we can instead skip it and log about the error. Change-Id: Ie40479befca78d8b5da343ef1a8420f703f07cb7 --- pkg/index/corpus.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/index/corpus.go b/pkg/index/corpus.go index ebdaacf6d..42594f569 100644 --- a/pkg/index/corpus.go +++ b/pkg/index/corpus.go @@ -845,7 +845,12 @@ func (c *Corpus) mergeEXIFGPSRow(k, v []byte) error { lat, err := strconv.ParseFloat(string(v[:pipe]), 64) long, err1 := strconv.ParseFloat(string(v[pipe+1:]), 64) if err != nil || err1 != nil { - return fmt.Errorf("bogus row %q = %q", k, v) + if err != nil { + log.Printf("index: bogus latitude in value of row %q = %q", k, v) + } else { + log.Printf("index: bogus longitude in value of row %q = %q", k, v) + } + return nil } c.gps[wholeRef] = latLong{lat, long} return nil