From 0e56d0fff65d33ed06443fb2980649820876b7aa Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <fabio@manganiello.tech>
Date: Fri, 27 Jan 2023 22:12:34 +0100
Subject: [PATCH] Double-check if self._thread != None on stop on the ntfy
 thread

Race conditions may occur here
---
 platypush/plugins/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platypush/plugins/__init__.py b/platypush/plugins/__init__.py
index fe9410fd2..9aabdadeb 100644
--- a/platypush/plugins/__init__.py
+++ b/platypush/plugins/__init__.py
@@ -110,7 +110,7 @@ class RunnablePlugin(Plugin):
             try:
                 if self._thread:
                     self._thread.join(timeout=self._stop_timeout)
-                    if self._thread.is_alive():
+                    if self._thread and self._thread.is_alive():
                         self.logger.warning(
                             f'Timeout (seconds={self._stop_timeout}) on '
                             'exit for the plugin '