Skip to content

Commit

Permalink
Fixes #525 labels support for qBittorrent < 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
erickok committed Jun 3, 2020
1 parent 114a887 commit 39d69ea
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,10 @@ private List<Label> parseJsonLabels(JSONArray response) throws JSONException {
Map<String, Label> 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());
Expand Down

0 comments on commit 39d69ea

Please sign in to comment.