mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-29 21:30:19 +02:00
fix(YouTube Music - Disable music video in album): App crashes on Android 5 / 6 devices
This commit is contained in:
parent
d4736e6dc6
commit
e0a977e73c
@ -13,6 +13,7 @@ import java.io.IOException;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
@ -39,11 +40,22 @@ public class PipedRequester {
|
|||||||
synchronized (cache) {
|
synchronized (cache) {
|
||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
|
|
||||||
cache.values().removeIf(request -> {
|
if (Utils.isSDKAbove(25)) {
|
||||||
final boolean expired = request.isExpired(now);
|
cache.values().removeIf(request -> {
|
||||||
if (expired) Logger.printDebug(() -> "Removing expired stream: " + request.videoId);
|
final boolean expired = request.isExpired(now);
|
||||||
return expired;
|
if (expired) Logger.printDebug(() -> "Removing expired stream: " + request.videoId);
|
||||||
});
|
return expired;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Iterator<Map.Entry<String, PipedRequester>> itr = cache.entrySet().iterator();
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
Map.Entry<String, PipedRequester> entry = itr.next();
|
||||||
|
if (entry.getValue().isExpired(now)) {
|
||||||
|
Logger.printDebug(() -> "Removing expired fetch: " + entry.getValue().videoId);
|
||||||
|
itr.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!cache.containsKey(videoId)) {
|
if (!cache.containsKey(videoId)) {
|
||||||
PipedRequester pipedRequester = new PipedRequester(videoId, playlistId, playlistIndex);
|
PipedRequester pipedRequester = new PipedRequester(videoId, playlistId, playlistIndex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user