Skip to content

Commit

Permalink
commands: Fixed panic when marshalers gave nil output
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Jan 6, 2015
1 parent 97a3688 commit 2816ed0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion commands/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ func (r *response) Marshal() (io.Reader, error) {
}
}

return marshaller(r)
output, err := marshaller(r)
if err != nil {
return nil, err
}
if output == nil {
return bytes.NewReader([]byte{}), nil
}
return output, nil
}

// Reader returns an `io.Reader` representing marshalled output of this Response
Expand Down

0 comments on commit 2816ed0

Please sign in to comment.