Fix edge case crash

This commit is contained in:
tj 2010-08-06 23:25:03 +02:00
parent f13d706686
commit 2235f8b8ed
2 changed files with 4 additions and 1 deletions

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/thoj/Go-IRC-Client-Library"
"fmt" "fmt"
"os" "os"
) )

3
irc.go
View File

@ -58,6 +58,9 @@ func reader(irc *IRCConnection) {
func writer(irc *IRCConnection) { func writer(irc *IRCConnection) {
for { for {
b := []byte(<-irc.pwrite) b := []byte(<-irc.pwrite)
if b == nil {
return
}
_, err := irc.socket.Write(b) _, err := irc.socket.Write(b)
if err != nil { if err != nil {
fmt.Printf("%s\n", err) fmt.Printf("%s\n", err)