From ec05b1a47e8f63477175b66d3120a3a977b4e5af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <philipp@hoerist.com>
Date: Sat, 13 Oct 2018 14:13:38 +0200
Subject: [PATCH] Catch exceptions when loading plugins

---
 gajim/plugins/pluginmanager.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gajim/plugins/pluginmanager.py b/gajim/plugins/pluginmanager.py
index 4072204195..096f90bee2 100644
--- a/gajim/plugins/pluginmanager.py
+++ b/gajim/plugins/pluginmanager.py
@@ -179,7 +179,12 @@ class PluginManager(metaclass=Singleton):
         :todo: what about adding plug-ins that are already added? Module reload
         and adding class from reloaded module or ignoring adding plug-in?
         '''
-        plugin = plugin_class()
+        try:
+            plugin = plugin_class()
+        except Exception:
+            log.exception('Error while loading a plugin')
+            return
+
         if plugin not in self.plugins:
             if not self._plugin_has_entry_in_global_config(plugin):
                 self._create_plugin_entry_in_global_config(plugin)
-- 
GitLab