Browse Source

pkg/report: add nil checking for getTimeSeries

Gyu-Ho Lee 9 years ago
parent
commit
69606bb95f
1 changed files with 5 additions and 1 deletions
  1. 5 1
      pkg/report/report.go

+ 5 - 1
pkg/report/report.go

@@ -112,6 +112,10 @@ func (r *report) Stats() <-chan Stats {
 	go func() {
 		defer close(donec)
 		r.processResults()
+		var ts TimeSeries
+		if r.sps != nil {
+			ts = r.sps.getTimeSeries()
+		}
 		donec <- Stats{
 			AvgTotal:   r.avgTotal,
 			Fastest:    r.fastest,
@@ -122,7 +126,7 @@ func (r *report) Stats() <-chan Stats {
 			Total:      r.total,
 			ErrorDist:  copyMap(r.errorDist),
 			Lats:       copyFloats(r.lats),
-			TimeSeries: r.sps.getTimeSeries(),
+			TimeSeries: ts,
 		}
 	}()
 	return donec