Skip to content

Commit 06750d4

Browse files
authored
Merge pull request #439 from replicatedhq/divolgin/nil
Don't panic when no data is collected
2 parents 8a29442 + 6d0a57b commit 06750d4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/collect/result.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ func NewResult() CollectorResult {
1919
}
2020

2121
func (r CollectorResult) SaveResult(bundlePath string, relativePath string, reader io.Reader) error {
22+
if reader == nil {
23+
return nil
24+
}
25+
2226
if bundlePath == "" {
2327
data, err := ioutil.ReadAll(reader)
2428
if err != nil {
@@ -28,10 +32,6 @@ func (r CollectorResult) SaveResult(bundlePath string, relativePath string, read
2832
return nil
2933
}
3034

31-
if reader == nil {
32-
return nil
33-
}
34-
3535
r[relativePath] = nil // save the the file name referencing the file on disk
3636

3737
fileDir, fileName := filepath.Split(relativePath)

0 commit comments

Comments
 (0)