diff options
-rw-r--r-- | lib/rbot/ircsocket.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb index 7ceba21b..df1f4e8a 100644 --- a/lib/rbot/ircsocket.rb +++ b/lib/rbot/ircsocket.rb @@ -100,11 +100,15 @@ module Irc # get the next line from the server (blocks) def gets - reply = @sock.gets - @lines_received += 1 - reply.strip! if reply - debug "RECV: #{reply.inspect}" - reply + begin + reply = @sock.gets + @lines_received += 1 + reply.strip! if reply + debug "RECV: #{reply.inspect}" + return reply + rescue + return nil + end end def queue(msg) |