From 917e4f3fbd68dfb73eb719dd213aa8fcda3e4e98 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sun, 4 Apr 2021 10:59:24 -0400 Subject: [PATCH] close #971 --- .../main/java/awais/instagrabber/utils/ResponseBodyUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java index 0d7acc16..aefc94f3 100644 --- a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java +++ b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java @@ -1094,7 +1094,6 @@ public final class ResponseBodyUtils { final List sortedCandidates = candidates.stream() .sorted((c1, c2) -> Integer.compare(c2.getWidth(), c1.getWidth())) .collect(Collectors.toList()); - if (sortedCandidates.size() == 1) return sortedCandidates.get(0).getUrl(); final List filteredCandidates = sortedCandidates.stream() .filter(c -> c.getWidth() <= media.getOriginalWidth() @@ -1102,6 +1101,7 @@ public final class ResponseBodyUtils { && (isSquare || Integer.compare(c.getWidth(), c.getHeight()) != 0) ) .collect(Collectors.toList()); + if (filteredCandidates.size() == 0) return sortedCandidates.get(0).getUrl(); final MediaCandidate candidate = filteredCandidates.get(0); if (candidate == null) return null; return candidate.getUrl();