Austin Huang
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
1 deletions
-
app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
|
|
@ -1094,7 +1094,6 @@ public final class ResponseBodyUtils { |
|
|
|
final List<MediaCandidate> 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<MediaCandidate> 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(); |
|
|
|