Merge pull request #439 from replicatedhq/divolgin/nil

Don't panic when no data is collected
This commit is contained in:
divolgin
2021-09-29 15:03:50 -07:00
committed by GitHub

View File

@@ -19,6 +19,10 @@ func NewResult() CollectorResult {
}
func (r CollectorResult) SaveResult(bundlePath string, relativePath string, reader io.Reader) error {
if reader == nil {
return nil
}
if bundlePath == "" {
data, err := ioutil.ReadAll(reader)
if err != nil {
@@ -28,10 +32,6 @@ func (r CollectorResult) SaveResult(bundlePath string, relativePath string, read
return nil
}
if reader == nil {
return nil
}
r[relativePath] = nil // save the the file name referencing the file on disk
fileDir, fileName := filepath.Split(relativePath)