diff --git a/modules/vfs/android/build.gradle b/modules/vfs/android/build.gradle index bf738c416eb..3cf55dd9bcc 100644 --- a/modules/vfs/android/build.gradle +++ b/modules/vfs/android/build.gradle @@ -39,5 +39,6 @@ android { dependencies { compileOnly project(path: ':pool') + compileOnly project(path: ':hippy-support') implementation deps.annotation } diff --git a/modules/vfs/android/src/main/java/com/tencent/vfs/VfsManager.java b/modules/vfs/android/src/main/java/com/tencent/vfs/VfsManager.java index f1665e86425..4f9d409d63f 100644 --- a/modules/vfs/android/src/main/java/com/tencent/vfs/VfsManager.java +++ b/modules/vfs/android/src/main/java/com/tencent/vfs/VfsManager.java @@ -19,6 +19,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.tencent.mtt.hippy.utils.LogUtils; import com.tencent.vfs.ResourceDataHolder.RequestFrom; import java.util.HashMap; import java.util.List; @@ -26,6 +27,8 @@ public class VfsManager { + private static final String TAG = "VfsManager"; + @NonNull private final CopyOnWriteArrayList mProcessorChain; private int mId; @@ -118,7 +121,15 @@ private void traverseForward(@NonNull final ResourceDataHolder holder, final boo int index = holder.index + 1; if (index < mProcessorChain.size()) { holder.index = index; - Processor processor = mProcessorChain.get(index); + Processor processor = null; + try { + processor = mProcessorChain.get(index); + } catch (IndexOutOfBoundsException e) { + LogUtils.e(TAG, "traverseForward get index " + index + " processor exception: " + e.getMessage()); + } + if (processor == null) { + return; + } if (isSync) { boolean goBack = processor.handleRequestSync(holder); if (goBack) { @@ -158,7 +169,15 @@ private void traverseGoBack(@NonNull final ResourceDataHolder holder, final bool int index = holder.index - 1; if (index >= 0 && index < mProcessorChain.size()) { holder.index = index; - Processor processor = mProcessorChain.get(index); + Processor processor = null; + try { + processor = mProcessorChain.get(index); + } catch (IndexOutOfBoundsException e) { + LogUtils.e(TAG, "traverseGoBack get index " + index + " processor exception: " + e.getMessage()); + } + if (processor == null) { + return; + } if (isSync) { processor.handleResponseSync(holder); traverseGoBack(holder, true);