Skip to content

Commit bc3eec4

Browse files
committed
Skipped uninstantiated DownloadControllers in MediaController.cleanup loop.
1 parent 9f81756 commit bc3eec4

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ public static DownloadController getInstance(int num) {
257257
return localInstance;
258258
}
259259

260+
public static boolean hasInstance(int num) {
261+
return Instance[num] != null;
262+
}
263+
260264
public DownloadController(int instance) {
261265
super(instance);
262266
SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);

TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,9 @@ public void cleanup() {
16281628
audioInfo = null;
16291629
playMusicAgain = false;
16301630
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
1631+
if (!DownloadController.hasInstance(a)) {
1632+
continue;
1633+
}
16311634
DownloadController.getInstance(a).cleanup();
16321635
}
16331636
videoConvertQueue.clear();

0 commit comments

Comments
 (0)