Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled panic() in the library #1

Open
srinathh opened this issue Dec 22, 2012 · 0 comments
Open

Unhandled panic() in the library #1

srinathh opened this issue Dec 22, 2012 · 0 comments

Comments

@srinathh
Copy link

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
}
}()
.....
.....
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant