diff --git a/download.go b/download.go index 9b36c75..11f0cb1 100644 --- a/download.go +++ b/download.go @@ -65,6 +65,10 @@ func downloadVideo(url string, path string, group GroupConfig) (err error) { defer videoDLResult.Close() file, err := os.OpenFile(tempPath+"-vid", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if err != nil { + return err + } + defer file.Close() io.Copy(file, videoDLResult) @@ -85,6 +89,10 @@ func downloadVideo(url string, path string, group GroupConfig) (err error) { defer audioDLResult.Close() file, err := os.OpenFile(tempPath+"-audio", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if err != nil { + return err + } + defer file.Close() io.Copy(file, audioDLResult)