Skip to content

Commit

Permalink
check before removing
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanh committed Dec 21, 2017
1 parent 357c471 commit a811db4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,12 @@ func handleHook(h *hook.Hook, rid string, headers, query, payload *map[string]in
}

for i := range files {
log.Printf("[%s] removing file %s\n", rid, files[i].File.Name())
err := os.Remove(files[i].File.Name())
if err != nil {
log.Printf("[%s] error removing file %s [%s]", rid, files[i].File.Name(), err)
if files[i].File != nil {
log.Printf("[%s] removing file %s\n", rid, files[i].File.Name())
err := os.Remove(files[i].File.Name())
if err != nil {
log.Printf("[%s] error removing file %s [%s]", rid, files[i].File.Name(), err)
}
}
}

Expand Down

0 comments on commit a811db4

Please sign in to comment.