From 4711a76c11357965c1dd1afd66e62dd199238535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Wed, 29 Jan 2020 10:43:08 +0100 Subject: [PATCH] Handle the case when we try to access an old measurement --- internal/database/actions.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/database/actions.go b/internal/database/actions.go index cf58b10..4f71173 100644 --- a/internal/database/actions.go +++ b/internal/database/actions.go @@ -55,6 +55,11 @@ func GetMeasurementJSON(sess sqlbuilder.Database, measurementID int64) (map[stri log.Errorf("failed to run query %s: %v", req.String(), err) return nil, err } + if measurement.Measurement.MeasurementFilePath.Valid == false { + log.Error("invalid measurement_file_path") + log.Error("backup your OONI_HOME and run `ooniprobe reset`") + return nil, errors.New("cannot access measurement file") + } measurementFilePath := measurement.Measurement.MeasurementFilePath.String // TODO handle the case in which we have MeasurementFilePath == NULL because // it's a beta measurement