Check for torrents in queue before calling the api stop_torrent() (#53895)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
This commit is contained in:
Jim Shank 2021-08-03 09:26:21 -07:00 committed by GitHub
parent 7518c58806
commit fa9ac71c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -447,6 +447,8 @@ class TransmissionData:
def stop_torrents(self):
"""Stop all active torrents."""
if len(self._torrents) == 0:
return
torrent_ids = [torrent.id for torrent in self._torrents]
self._api.stop_torrent(torrent_ids)