Don't panic when no data is collected
@@ -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)
