From 871097af8c8f8c522f8489ae3b3a83407f72984f Mon Sep 17 00:00:00 2001
From: Matt <matt@mattcarey.me>
Date: Sat, 21 Jan 2017 22:50:04 -0500
Subject: [PATCH] Fixed crash as a result of no torrents in client

---
 clients/deluge.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/clients/deluge.py b/clients/deluge.py
index acf9982..a6afdb5 100644
--- a/clients/deluge.py
+++ b/clients/deluge.py
@@ -115,7 +115,7 @@ class DelugeClient(TorrentClient):
         try:
             res = urlopen(req)
         except URLError as e:
-            msg = 'Failed To Authenticate with torrent client.  HTTP Error'
+            msg = 'Failed To Authenticate with torrent client.  HTTP Error. Aborting'
             self.send_log(msg, 'critical')
             print(e)
             sys.exit(1)
@@ -175,6 +175,9 @@ class DelugeClient(TorrentClient):
             return
 
         output = self._process_response(res)
+        if not output:
+            return
+
         if output['error']:
             msg = 'Problem getting torrent list from {}. Error: {}'.format(self.torrent_client, output['error'])
             self.send_log(msg, 'error')
-- 
GitLab