From 494d005fa7c03c36c06479c6defd8f1cd28ead9a Mon Sep 17 00:00:00 2001 From: Escartem Date: Wed, 1 May 2024 15:47:30 +0200 Subject: [PATCH] fix invalid container crash --- AssetStudio.GUI/Studio.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/AssetStudio.GUI/Studio.cs b/AssetStudio.GUI/Studio.cs index 5bb379e..36a90c4 100644 --- a/AssetStudio.GUI/Studio.cs +++ b/AssetStudio.GUI/Studio.cs @@ -304,9 +304,18 @@ namespace AssetStudio.GUI var preloadIndex = m_Container.Value.preloadIndex; var preloadSize = m_Container.Value.preloadSize; var preloadEnd = preloadIndex + preloadSize; - for (int k = preloadIndex; k < preloadEnd; k++) + + switch(preloadIndex) { - containers.Add((m_AssetBundle.m_PreloadTable[k], m_Container.Key)); + case int n when n < 0: + Logger.Warning($"preloadIndex {preloadIndex} is out of preloadTable range"); + break; + default: + for (int k = preloadIndex; k < preloadEnd; k++) + { + containers.Add((m_AssetBundle.m_PreloadTable[k], m_Container.Key)); + } + break; } } }