From 073660491ea12a45065aaffebee3ee79f0eb892b Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 9 Sep 2024 23:12:36 +0800 Subject: [PATCH] fix: ArrayIndexOutOfBoundsException in DownloadController SparseArray --- .../java/org/telegram/messenger/DownloadController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java index 4bc86d44a9..5be8160ed9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Locale; +import java.util.concurrent.ConcurrentHashMap; import cn.hutool.core.util.StrUtil; import tw.nekomimi.nekogram.NekoConfig; @@ -72,7 +73,7 @@ public interface FileDownloadProgressListener { private HashMap>> loadingFileObservers = new HashMap<>(); private HashMap> loadingFileMessagesObservers = new HashMap<>(); - private SparseArray observersByTag = new SparseArray<>(); + private ConcurrentHashMap observersByTag = new ConcurrentHashMap<>(); private boolean listenerInProgress = false; private HashMap addLaterArray = new HashMap<>(); private ArrayList deleteLaterArray = new ArrayList<>(); @@ -80,11 +81,11 @@ public interface FileDownloadProgressListener { private boolean loadingAutoDownloadConfig; - private LongSparseArray typingTimes = new LongSparseArray<>(); + private ConcurrentHashMap typingTimes = new ConcurrentHashMap<>(); public final ArrayList downloadingFiles = new ArrayList<>(); public final ArrayList recentDownloadingFiles = new ArrayList<>(); - public final SparseArray unviewedDownloads = new SparseArray<>(); + public final ConcurrentHashMap unviewedDownloads = new ConcurrentHashMap<>(); public static class Preset { public int[] mask = new int[4];