mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Fix closeable panic
Fix closeable panic when conn == nil
This commit is contained in:
@@ -48,6 +48,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
|
||||
* [Jason Maldonis](https://github.com/jjmaldonis)
|
||||
* [Nevio Vesic](https://github.com/0x19)
|
||||
* [David Hamilton](https://github.com/dihamilton)
|
||||
* [adwpc](https://github.com/adwpc)
|
||||
|
||||
### License
|
||||
MIT License - see [LICENSE](LICENSE) for full text
|
||||
|
||||
@@ -22,6 +22,11 @@ type closeable interface {
|
||||
|
||||
// Close a net.Conn and log if we have a failure
|
||||
func closeConnAndLog(c closeable, log logging.LeveledLogger, msg string) {
|
||||
if c == nil {
|
||||
log.Warnf("Conn is not allocated")
|
||||
return
|
||||
}
|
||||
|
||||
log.Warnf(msg)
|
||||
if err := c.Close(); err != nil {
|
||||
log.Warnf("Failed to close conn: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user