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
@@ -388,7 +388,12 @@ namespace Ryujinx.Cpu.Jit.HostTracked
_treeLock.ExitReadLock();
}
return (_backingMemory, _firstPagePa.Value);
if (_firstPagePa != null)
{
return (_backingMemory, _firstPagePa.Value);
}
return (null, 0);
}
public PrivateRange GetPrivateAllocation(ulong va)
@@ -135,7 +135,10 @@ namespace Ryujinx.Cpu.Jit
offset += (int)copySize;
}
return new ReadOnlySequence<byte>(first, 0, last, (int)(size - last.RunningIndex));
if (last != null)
{
return new ReadOnlySequence<byte>(first, 0, last, (int)(size - last.RunningIndex));
}
}
catch (InvalidMemoryRegionException)
{
@@ -146,6 +149,8 @@ namespace Ryujinx.Cpu.Jit
return ReadOnlySequence<byte>.Empty;
}
return default;
}
/// <inheritdoc/>