From: Chris Gahan Date: Thu, 1 Jun 2006 06:13:29 +0000 (+0000) Subject: giuseppe.bilotta's patch: "Fix exception when connection with server times out" X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=044b659e50c0c3f90f1de2b48a482a48b0668918;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git giuseppe.bilotta's patch: "Fix exception when connection with server times out" --- 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)