-
Couldn't load subscription status.
- Fork 182
Description
Your environment
- Version: [email protected]
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.