go-id3
go-id3 copied to clipboard
Unhandled panic() in the library
HI,
i found 2 unhandled panics in the library below which causes a crash in the program using the library when i encounter malformed conditions like weird encodings: (a) id3.go, line 78: panic(fmt.Sprintf("Unrecognized ID3v2 version: %d", file.Header.Version)) (b) util.go, line 156: panic(err)
My current retrofit for the Read function is to add a defer with a recover & return nil instead of *File. However, i believe a better solution would be to return both a File & a more descriptive error object
func Read(reader io.Reader) (retfil *File) { defer func() { if r := recover(); r != nil { retfil = nil } }() ..... ..... }