swarm, api, http: Don't panic on error from GetDirectoryTar

This commit is contained in:
Pyshnenko Alexey 2018-08-14 19:09:59 +03:00
parent a1783d1697
commit d5e5043072

View file

@ -189,7 +189,9 @@ func (s *Server) HandleBzzGet(w http.ResponseWriter, r *http.Request) {
if err != nil {
RespondError(w, r, fmt.Sprintf("Had an error building the tarball: %v", err), http.StatusInternalServerError)
}
defer reader.Close()
if reader != nil {
defer reader.Close()
}
w.Header().Set("Content-Type", "application/x-tar")
w.WriteHeader(http.StatusOK)