check for nil listener before close

This commit is contained in:
Bradley Cicenas 2017-02-18 03:37:00 +00:00
parent 0e8480ce5d
commit db050031df
2 changed files with 8 additions and 6 deletions

View File

@ -44,7 +44,9 @@ func StartServer() {
func StopServer() { func StopServer() {
server.wg.Wait() server.wg.Wait()
server.ln.Close() if server.ln != nil {
server.ln.Close()
}
} }
func handler(conn net.Conn) { func handler(conn net.Conn) {

View File

@ -15,8 +15,8 @@ var helpDialog = []menu.Item{
} }
func HelpMenu() { func HelpMenu() {
ResetView() ui.DefaultEvtStream.ResetHandlers()
defer ResetView() defer ui.DefaultEvtStream.ResetHandlers()
m := menu.NewMenu() m := menu.NewMenu()
m.TextFgColor = ui.ColorWhite m.TextFgColor = ui.ColorWhite
@ -32,7 +32,7 @@ func HelpMenu() {
func FilterMenu() { func FilterMenu() {
ui.DefaultEvtStream.ResetHandlers() ui.DefaultEvtStream.ResetHandlers()
defer ResetView() defer ui.DefaultEvtStream.ResetHandlers()
i := widgets.NewInput() i := widgets.NewInput()
i.TextFgColor = ui.ColorWhite i.TextFgColor = ui.ColorWhite
@ -49,8 +49,8 @@ func FilterMenu() {
} }
func SortMenu() { func SortMenu() {
ResetView() ui.DefaultEvtStream.ResetHandlers()
defer ResetView() defer ui.DefaultEvtStream.ResetHandlers()
m := menu.NewMenu() m := menu.NewMenu()
m.Selectable = true m.Selectable = true