Add nil-receiver awareness to all Reader/Writer

This commit is contained in:
Alexander Neumann 2015-05-01 17:13:03 +02:00
parent dbc41bb805
commit 98dc811536
5 changed files with 20 additions and 3 deletions

View file

@ -24,6 +24,10 @@ func NewHashAppendWriter(w io.Writer, h hash.Hash) *HashAppendWriter {
}
func (h *HashAppendWriter) Close() error {
if h == nil {
return nil
}
if !h.closed {
h.closed = true