Browse Source

close #971

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
committed by GitHub
parent
commit
917e4f3fbd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java

2
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();

Loading…
Cancel
Save