fix bug with invalid APIC mimetype

Return an error if the mimetype can't be decoded rather than
panicking. See #28.
This commit is contained in:
Anders Pearson 2017-10-22 11:42:29 +01:00
parent e24fc33f60
commit 22a6715536
No known key found for this signature in database
GPG Key ID: 17AE7A96EF815301

View File

@ -597,6 +597,9 @@ func readAPICFrame(b []byte) (*Picture, error) {
mimeType := string(mimeDataSplit[0])
b = mimeDataSplit[1]
if len(b) < 1 {
return nil, fmt.Errorf("error decoding APIC mimetype")
}
picType := b[0]
descDataSplit, err := dataSplit(b[1:], enc)