Browse Source

Merge pull request #483 from kubecost/bolt/prom-results-fix

Fix for nil QueryResults in channel adapter.
Matt Bolt 5 năm trước cách đây
mục cha
commit
8207eeff49
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      pkg/prom/result.go

+ 6 - 0
pkg/prom/result.go

@@ -19,6 +19,12 @@ type QueryResultsChan chan *QueryResults
 func (qrc QueryResultsChan) Await() []*QueryResult {
 func (qrc QueryResultsChan) Await() []*QueryResult {
 	defer close(qrc)
 	defer close(qrc)
 	results := <-qrc
 	results := <-qrc
+
+	// Possible that the returned results are nil
+	if results == nil {
+		return nil
+	}
+
 	return results.Results
 	return results.Results
 }
 }