la5nta / wl2k-go

A Winlink framework for Go.
https://getpat.io
MIT License
50 stars 20 forks source link

transport/ax25: nil pointer dereferenced in ax25.(*Conn).RemoteAddr() #10

Closed martinhpedersen closed 8 years ago

martinhpedersen commented 8 years ago

This bug emerged when I added the event-log, which tries to access the conn's RemoteAddr after connect. I don't know if the connect was successful or not, but conn was clearly not nil.

2015/10/04 18:10:00 Connecting to ax25:LA1B-10...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x5447a1]

goroutine 50 [running]:
github.com/la5nta/wl2k-go/transport/ax25.(*Conn).RemoteAddr(0x0, 0x0, 0x0)
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/transport/ax25/ax25.go:60 +0x81
main.(*EventLogger).LogConn(0xc82000f970, 0xc82039ca40, 0x14, 0x0, 0x7f6a955a31c0, 0x0, 0x7f6a9861f028, 0xc820387a20)
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/cmd/wl2k/event_log.go:43 +0x266
main.Connect(0xc82000f820, 0xc, 0xc82000f800)
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/cmd/wl2k/connect.go:107 +0x884
main.connectAny(0xc820012500, 0x4, 0x4, 0x7)
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/cmd/wl2k/connect.go:21 +0x85
main.Connect(0xc82000f7f8, 0x7, 0x914700)
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/cmd/wl2k/connect.go:34 +0x115
main.execCmd(0xc82000f7f0, 0xf, 0xc820041e00)
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/cmd/wl2k/interactive.go:48 +0x357
main.scheduleLoop.func1(0xc820178000, 0x1, 0x1)
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/cmd/wl2k/schedule.go:38 +0x23f
created by main.scheduleLoop
        /media/Diverse/Development/Go/src/github.com/la5nta/wl2k-go/cmd/wl2k/schedule.go:42 +0x2cb