diff --git a/README.md b/README.md index 788a292..cbb55fd 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [ZHENK](https://github.com/scorpionknifes) * [Assad Obaid](https://github.com/assadobaid) * [Antoine Baché](https://github.com/Antonito) +* [Will Forcey](https://github.com/wawesomeNOGUI) ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/candidatepair.go b/candidatepair.go index 00f904e..49dec37 100644 --- a/candidatepair.go +++ b/candidatepair.go @@ -26,6 +26,10 @@ type candidatePair struct { } func (p *candidatePair) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("prio %d (local, prio %d) %s <-> %s (remote, prio %d)", p.Priority(), p.local.Priority(), p.local, p.remote, p.remote.Priority()) } diff --git a/candidatepair_test.go b/candidatepair_test.go index 12a4c38..70788c1 100644 --- a/candidatepair_test.go +++ b/candidatepair_test.go @@ -122,3 +122,11 @@ func TestCandidatePairEquality(t *testing.T) { t.Fatalf("Expected %v to equal %v", pairA, pairB) } } + +func TestNilCandidatePairString(t *testing.T) { + var nilCandidatePair *candidatePair + + if res := nilCandidatePair.String(); res != "" { + t.Fatalf("Expected %v to equal %v", res, "") + } +}