Apply suggestions from code review

Co-authored-by: David Howden <dhowden@gmail.com>
This commit is contained in:
Aleksey 2021-09-19 16:23:20 +03:00 committed by GitHub
parent b4ea69b945
commit cfaa6a7d55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
mp4.go
View File

@ -638,7 +638,7 @@ func (m metadataMP4) readAtomData(r io.ReadSeeker, name string, size uint32, pro
data = string(b)
case "uint8":
if len(b) < 1 {
if len(b) == 0 {
return fmt.Errorf("invalid encoding: expected at least %d bytes, for integer tag data, got %d", 1, len(b))
}
data = getInt(b[len(b)-1:])
@ -759,7 +759,7 @@ func (m metadataMP4) Composer() string {
func (m metadataMP4) Genre() string {
genre := m.getString(atoms.Name("genre"))
if len(genre) < 1 {
if len(genre) == 0 {
genreID := m.getInt(atoms.Name("genre ID"))
if genreID == 0 {
genreID := m.getInt(atoms.Name("genre ID3v1 ID")) - 1