cmd/benchseries: avoid some nil pointer panics for missing data

Change-Id: I1e4dea3ecc88d30d8d0928f4bf207deb7adea9b7
Reviewed-on: https://go-review.googlesource.com/c/perf/+/521836
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/benchseries/benchseries.go b/benchseries/benchseries.go
index 74f674a..3e080c7 100644
--- a/benchseries/benchseries.go
+++ b/benchseries/benchseries.go
@@ -303,9 +303,10 @@
 			b.warn("%v\n", err)
 			continue
 		}
-		res := rec.(*benchfmt.Result)
-
-		b.Add(res)
+		res, ok := rec.(*benchfmt.Result)
+		if ok {
+			b.Add(res)
+		}
 	}
 	if err := files.Err(); err != nil {
 		return err
@@ -575,6 +576,9 @@
 				if c.Numerator == nil {
 					continue
 				}
+				if c.Denominator == nil {
+					continue
+				}
 				for k, _ := range c.Numerator.Residues {
 					s := k.Get(f)
 					if !seen[seenKey{f, s}] {
diff --git a/benchseries/chart.go b/benchseries/chart.go
index 2e4c755..17d765f 100644
--- a/benchseries/chart.go
+++ b/benchseries/chart.go
@@ -88,6 +88,10 @@
 			selectedPoints = append(selectedPoints, &Point{numHash: hp.NumHash, denHash: hp.DenHash, values: values, changes: changes, changeBVID: changeBenches})
 		}
 
+		if len(selectedPoints) == 0 {
+			continue
+		}
+
 		// Want lines that grab most of the data; it's outliers we worry about
 		sort.Float64s(allValues)
 		lav := len(allValues)