Compare commits

..

2 Commits

Author SHA1 Message Date
Eric Kok b3532a4b7f
Merge pull request #643 from bwitt/fix-qb-no-categories 2 years ago
Brian Witt d605ceb971 qBittorrent: Fix working with no categories 2 years ago
  1. 6
      app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java

6
app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java

@ -237,10 +237,12 @@ public class QBittorrentAdapter implements IDaemonAdapter {
JSONArray allTorrentsResult = new JSONArray(makeRequest(log, path)); JSONArray allTorrentsResult = new JSONArray(makeRequest(log, path));
final List<Torrent> torrentsList = parseJsonTorrents(allTorrentsResult); final List<Torrent> torrentsList = parseJsonTorrents(allTorrentsResult);
JSONArray allLabelsResult; JSONArray allLabelsResult = null;
if (version >= 40100) { if (version >= 40100) {
allLabelsResult = new JSONObject(makeRequest(log, "/api/v2/torrents/categories")).names(); allLabelsResult = new JSONObject(makeRequest(log, "/api/v2/torrents/categories")).names();
} else { }
// either version < 40100 or no labels
if (allLabelsResult == null) {
allLabelsResult = new JSONArray(); allLabelsResult = new JSONArray();
} }
final List<Label> labelList = parseJsonLabels(allLabelsResult, allTorrentsResult); final List<Label> labelList = parseJsonLabels(allLabelsResult, allTorrentsResult);

Loading…
Cancel
Save