From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 1 Jul 2016 21:13:19 +0000 (+0200)
Subject: Fix crash on server connect error.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D/templates?a=commitdiff_plain;h=53c90d5436ff2a60a6b689fddc9e5e79e0dd7b25;p=plomlombot-irc.git

Fix crash on server connect error.
---

diff --git a/plomlombot.py b/plomlombot.py
index 4c44cf4..80def0d 100755
--- a/plomlombot.py
+++ b/plomlombot.py
@@ -118,7 +118,10 @@ class IO:
         self.line_buffer = []
         self.rune_buffer = ""
         self.last_pong = time.time()
-        self.servername = self.recv_line(send_ping=False).split(" ")[0][1:]
+        line = self.recv_line(send_ping=False)
+        if not line or len(line) < 1:
+            raise ExceptionForRestart
+        self.servername = line.split(" ")[0][1:]
 
     def _pingtest(self, send_ping=True):
         if self.last_pong + self.timeout < time.time():