Better error handling when cover art cannot be loaded

This commit is contained in:
Deluan
2020-01-20 22:30:16 -05:00
parent c6ed0d5377
commit 8a1110044c
2 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -2,6 +2,7 @@ package engine
import (
"bytes"
"errors"
"image"
_ "image/gif"
"image/jpeg"
@@ -100,5 +101,9 @@ func readFromTag(path string) (io.Reader, error) {
return nil, err
}
return bytes.NewReader(m.Picture().Data), nil
picture := m.Picture()
if picture == nil {
return nil, errors.New("error extracting art from file " + path)
}
return bytes.NewReader(picture.Data), nil
}