misc: chore: Fix numerous NullReferenceExceptions, InvalidOperationExceptions

This commit is contained in:
KeatonTheBot
2025-06-20 16:33:20 -05:00
parent 9b6b9146e2
commit d0abbc6da3
90 changed files with 667 additions and 533 deletions
+2 -1
View File
@@ -67,7 +67,8 @@ namespace Ryujinx.Graphics.Gpu.Image
public T FindOrCreate(GpuChannel channel, ulong address, int maximumId, TextureBindingsArrayCache bindingsArrayCache)
{
// Remove old entries from the cache, if possible.
while (_pools.Count > MaxCapacity && (_currentTimestamp - _pools.First.Value.CacheTimestamp) >= MinDeltaForRemoval)
while (_pools.Count > MaxCapacity && _pools.First != null &&
(_currentTimestamp - _pools.First.Value.CacheTimestamp) >= MinDeltaForRemoval)
{
T oldestPool = _pools.First.Value;