mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-07 06:50:00 +02:00
misc: Tweak NullReferenceException fixes
This commit is contained in:
@@ -60,12 +60,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
||||
|
||||
KernelContext.CriticalSection.Enter();
|
||||
|
||||
if (list.Count != 0)
|
||||
if (list.Count != 0 && list.First != null)
|
||||
{
|
||||
if (list.First != null)
|
||||
{
|
||||
session = list.First.Value;
|
||||
}
|
||||
session = list.First.Value;
|
||||
|
||||
list.RemoveFirst();
|
||||
}
|
||||
|
||||
@@ -32,13 +32,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||
|
||||
public ref T GetRef<T>(ulong offset) where T : unmanaged
|
||||
{
|
||||
if (_pageList.Nodes.Count == 1)
|
||||
if (_pageList.Nodes.Count == 1 && _pageList.Nodes.First != null)
|
||||
{
|
||||
if (_pageList.Nodes.First != null)
|
||||
{
|
||||
ulong address = _pageList.Nodes.First.Value.Address - DramMemoryMap.DramBase;
|
||||
return ref _context.Memory.GetRef<T>(address + offset);
|
||||
}
|
||||
ulong address = _pageList.Nodes.First.Value.Address - DramMemoryMap.DramBase;
|
||||
return ref _context.Memory.GetRef<T>(address + offset);
|
||||
}
|
||||
|
||||
throw new NotImplementedException("Non-contiguous shared memory is not yet supported.");
|
||||
|
||||
@@ -164,8 +164,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
||||
Logger.Debug?.Print(LogClass.ServiceNv, $"Deallocation resulted in new free range from 0x{expandedStart:X} to 0x{expandedEnd:X}.");
|
||||
|
||||
_tree.Add(expandedStart, expandedEnd);
|
||||
LinkedListNode<ulong> nodePtr = _list.AddAfter(node, expandedStart);
|
||||
_dictionary[expandedStart] = nodePtr;
|
||||
if (node != null)
|
||||
{
|
||||
LinkedListNode<ulong> nodePtr = _list.AddAfter(node, expandedStart);
|
||||
_dictionary[expandedStart] = nodePtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,11 +199,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
||||
if (address < AddressSpaceSize)
|
||||
{
|
||||
bool reachedEndOfAddresses = false;
|
||||
ulong targetAddress;
|
||||
ulong targetAddress = 0;
|
||||
if (start == DefaultStart)
|
||||
{
|
||||
Logger.Debug?.Print(LogClass.ServiceNv, $"Target address set to start of the last available range: 0x{_list.Last.Value:X}.");
|
||||
targetAddress = _list.Last.Value;
|
||||
if (_list.Last != null)
|
||||
{
|
||||
Logger.Debug?.Print(LogClass.ServiceNv, $"Target address set to start of the last available range: 0x{_list.Last.Value:X}.");
|
||||
targetAddress = _list.Last.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -97,8 +97,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm
|
||||
|
||||
IpcService service = GetServiceInstance(type, context, serviceAttribute.Parameter);
|
||||
|
||||
service.TrySetServer(_commonServer);
|
||||
service.Server.AddSessionObj(session.ServerSession, service);
|
||||
service?.TrySetServer(_commonServer);
|
||||
service?.Server.AddSessionObj(session.ServerSession, service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user