pixiecore: only close a non-nil body in API mode.

Fixes #7.
This commit is contained in:
David Anderson 2016-09-02 13:25:27 -07:00
parent f061a783a7
commit 445f92459b

View File

@ -154,7 +154,9 @@ func (b *apibooter) getAPIResponse(hw net.HardwareAddr) (io.ReadCloser, error) {
func (b *apibooter) BootSpec(m Machine) (*Spec, error) {
body, err := b.getAPIResponse(m.MAC)
defer body.Close()
if body != nil {
defer body.Close()
}
if err != nil {
return nil, err
}