From 39d69ea7ed9e55dc2c502c375590ed3ce653c553 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 3 Jun 2020 09:34:23 +0200 Subject: [PATCH] Fixes #525 labels support for qBittorrent < 4.1 --- .../transdroid/daemon/Qbittorrent/QbittorrentAdapter.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java b/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java index 50440db8..2b81edfe 100644 --- a/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java +++ b/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java @@ -641,12 +641,10 @@ public class QbittorrentAdapter implements IDaemonAdapter { Map labels = new HashMap<>(); for (int i = 0; i < response.length(); i++) { JSONObject tor = response.getJSONObject(i); - if (version >= 40100) { + if (tor.has("category")) { String label = tor.optString("category"); - if (label != null && label.length() > 0) { - final Label labelObject = labels.get(label); - labels.put(label, new Label(label, (labelObject != null) ? labelObject.getCount() + 1 : 1)); - } + final Label labelObject = labels.get(label); + labels.put(label, new Label(label, (labelObject != null) ? labelObject.getCount() + 1 : 1)); } } return new ArrayList<>(labels.values());