diff --git a/README.md b/README.md index 66c20e7..1079c77 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [Chao Yuan](https://github.com/yuanchao0310) * [Jason Maldonis](https://github.com/jjmaldonis) * [Nevio Vesic](https://github.com/0x19) +* [David Hamilton](https://github.com/dihamilton) ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/candidate_base.go b/candidate_base.go index 2d7d664..3e93bbf 100644 --- a/candidate_base.go +++ b/candidate_base.go @@ -194,7 +194,11 @@ func (c *candidateBase) String() string { // LastReceived returns a time.Time indicating the last time // this candidate was received func (c *candidateBase) LastReceived() time.Time { - return c.lastReceived.Load().(time.Time) + lastReceived := c.lastReceived.Load() + if lastReceived == nil { + return time.Time{} + } + return lastReceived.(time.Time) } func (c *candidateBase) setLastReceived(t time.Time) { @@ -204,7 +208,11 @@ func (c *candidateBase) setLastReceived(t time.Time) { // LastSent returns a time.Time indicating the last time // this candidate was sent func (c *candidateBase) LastSent() time.Time { - return c.lastSent.Load().(time.Time) + lastSent := c.lastSent.Load() + if lastSent == nil { + return time.Time{} + } + return lastSent.(time.Time) } func (c *candidateBase) setLastSent(t time.Time) {