flac: fix Close method to close underlying file descriptor

This commit is contained in:
mewmew 2018-04-08 17:47:05 +02:00
parent d1bcf309b2
commit ffd35219d3

View file

@ -192,8 +192,8 @@ func ParseFile(path string) (stream *Stream, err error) {
// Close closes the stream if opened through a call to Open or ParseFile, and
// performs no operation otherwise.
func (stream *Stream) Close() error {
if r, ok := stream.r.(io.Closer); ok {
return r.Close()
if stream.c != nil {
return stream.c.Close()
}
return nil
}