From 8585ef18eb0f32dd1fd1fea122f33b3ae63cc062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 12 Apr 2020 16:43:01 +0200 Subject: plugins: don't access property on uninitialized plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/plugin_manager.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/poezio/plugin_manager.py b/poezio/plugin_manager.py index c44a8ecc..874d0dc9 100644 --- a/poezio/plugin_manager.py +++ b/poezio/plugin_manager.py @@ -158,13 +158,14 @@ class PluginManager: if name in self.plugins: try: - self.plugins[name]._unloading = True # Prevents loops - for rdep in self.rdeps[name].copy(): - if rdep in self.plugins and not self.plugins[rdep]._unloading: - self.unload(rdep) - if rdep in self.plugins: - log.debug('Failed to unload reverse dependency %s first.', rdep) - return None + if self.plugins[name] is not None: + self.plugins[name]._unloading = True # Prevents loops + for rdep in self.rdeps[name].copy(): + if rdep in self.plugins and not self.plugins[rdep]._unloading: + self.unload(rdep) + if rdep in self.plugins: + log.debug('Failed to unload reverse dependency %s first.', rdep) + return None for command in self.commands[name].keys(): del self.core.commands[command] -- cgit v1.2.3