From 2235f8b8ed5481c3957329cddd5f5a39102b0b90 Mon Sep 17 00:00:00 2001 From: tj Date: Fri, 6 Aug 2010 23:25:03 +0200 Subject: [PATCH] Fix edge case crash --- example/test.go | 2 +- irc.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/example/test.go b/example/test.go index 4759dbc..7022235 100644 --- a/example/test.go +++ b/example/test.go @@ -1,7 +1,7 @@ package main import ( - "irc" + irc "github.com/thoj/Go-IRC-Client-Library" "fmt" "os" ) diff --git a/irc.go b/irc.go index 981598e..1fb44da 100644 --- a/irc.go +++ b/irc.go @@ -58,6 +58,9 @@ func reader(irc *IRCConnection) { func writer(irc *IRCConnection) { for { b := []byte(<-irc.pwrite) + if b == nil { + return + } _, err := irc.socket.Write(b) if err != nil { fmt.Printf("%s\n", err)