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

Potential Bug in func GetSelectedCandidatePair #747

Open
shaheerem opened this issue Nov 27, 2024 · 0 comments
Open

Potential Bug in func GetSelectedCandidatePair #747

shaheerem opened this issue Nov 27, 2024 · 0 comments

Comments

@shaheerem
Copy link

shaheerem commented Nov 27, 2024

Your environment

What did you do?

We have an application which uses pion ice for connectivity & candidate gathering with coturn.

What did you expect?

I expected that GetSelectedCandidatePair() func would return err if selectedPair is nil, but it doesn't, it returns nil pairs and nil error.

What happened?

In my code, I had written this line:

`
// the ice connection has been established successfully we are ready to start the proxy
pair, err := conn.agent.GetSelectedCandidatePair()

if err != nil {
	return errors.Wrapf(err, "failed to get selected candidate pairs for %s", conn.config.RemoteId)
}

localCandidate := pair.Local.Address()
remoteCandidate := pair.Remote.Address()
    ...

`
Here I was only checking if err is nil, then it returned, but in this case, it returned error as nil, and pair as nil as well. Which failed the next line.
Although, it can be seen as a flaw in my code, but I think it should return error in case pairs are nil.

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

No branches or pull requests

1 participant