diff --git a/homeassistant/components/recorder/pool.py b/homeassistant/components/recorder/pool.py index 76b8aceb30f..02985f9d0c3 100644 --- a/homeassistant/components/recorder/pool.py +++ b/homeassistant/components/recorder/pool.py @@ -37,7 +37,7 @@ class RecorderPool(SingletonThreadPool, NullPool): def shutdown(self): """Close the connection.""" - if self.recorder_or_dbworker and (conn := self._conn.current()): + if self.recorder_or_dbworker and self._conn and (conn := self._conn.current()): conn.close() def dispose(self):