mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix qBittorrent torrent count when empty (#106903)
* Fix qbittorrent torrent cound when empty * lint fix * Change based on comment
This commit is contained in:
parent
f66438b0ce
commit
711498793a
@ -165,6 +165,10 @@ def count_torrents_in_states(
|
|||||||
coordinator: QBittorrentDataCoordinator, states: list[str]
|
coordinator: QBittorrentDataCoordinator, states: list[str]
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Count the number of torrents in specified states."""
|
"""Count the number of torrents in specified states."""
|
||||||
|
# When torrents are not in the returned data, there are none, return 0.
|
||||||
|
if "torrents" not in coordinator.data:
|
||||||
|
return 0
|
||||||
|
|
||||||
if not states:
|
if not states:
|
||||||
return len(coordinator.data["torrents"])
|
return len(coordinator.data["torrents"])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user