mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-18 10:37:04 +00:00
misc: chore: Fix possible NullReferenceExceptions, InvalidOperationExceptions
This commit is contained in:
parent
fa682d406e
commit
51b32981b6
15 changed files with 70 additions and 49 deletions
|
|
@ -58,7 +58,7 @@ namespace ARMeilleure.Translation
|
||||||
|
|
||||||
private static string GetKey(MethodInfo info)
|
private static string GetKey(MethodInfo info)
|
||||||
{
|
{
|
||||||
return $"{info.DeclaringType.Name}.{info.Name}";
|
return $"{info.DeclaringType?.Name}.{info.Name}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly SortedList<string, DelegateInfo> _delegates;
|
private static readonly SortedList<string, DelegateInfo> _delegates;
|
||||||
|
|
|
||||||
|
|
@ -316,13 +316,16 @@ namespace ARMeilleure.Translation
|
||||||
{
|
{
|
||||||
_root = newNode;
|
_root = newNode;
|
||||||
}
|
}
|
||||||
else if (start.CompareTo(parent.Start) < 0)
|
else if (parent != null && start.CompareTo(parent.Start) < 0)
|
||||||
{
|
{
|
||||||
parent.Left = newNode;
|
parent.Left = newNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parent.Right = newNode;
|
if (parent != null)
|
||||||
|
{
|
||||||
|
parent.Right = newNode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PropagateIncrease(newNode);
|
PropagateIncrease(newNode);
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Descriptors != null)
|
if (Descriptors != null && other.Descriptors != null)
|
||||||
{
|
{
|
||||||
if (Descriptors.Count != other.Descriptors.Count)
|
if (Descriptors.Count != other.Descriptors.Count)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -240,44 +240,47 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
int dstOffset = 0;
|
int dstOffset = 0;
|
||||||
bool activeRange = false;
|
bool activeRange = false;
|
||||||
|
|
||||||
for (int i = 0; i < list.Count; i++)
|
if (list != null)
|
||||||
{
|
{
|
||||||
var range = list[i];
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
|
||||||
int rangeEnd = range.Offset + range.Size;
|
|
||||||
|
|
||||||
if (activeRange)
|
|
||||||
{
|
{
|
||||||
if (range.Offset >= endOffset)
|
var range = list[i];
|
||||||
|
|
||||||
|
int rangeEnd = range.Offset + range.Size;
|
||||||
|
|
||||||
|
if (activeRange)
|
||||||
{
|
{
|
||||||
break;
|
if (range.Offset >= endOffset)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rangeEnd <= offset)
|
|
||||||
{
|
{
|
||||||
continue;
|
if (rangeEnd <= offset)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
activeRange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
activeRange = true;
|
int baseSize = range.Offset - srcOffset;
|
||||||
}
|
|
||||||
|
|
||||||
int baseSize = range.Offset - srcOffset;
|
if (baseSize > 0)
|
||||||
|
{
|
||||||
|
baseData.Slice(dstOffset, baseSize).CopyTo(result.Slice(dstOffset, baseSize));
|
||||||
|
srcOffset += baseSize;
|
||||||
|
dstOffset += baseSize;
|
||||||
|
}
|
||||||
|
|
||||||
if (baseSize > 0)
|
int modSize = Math.Min(rangeEnd - srcOffset, endOffset - srcOffset);
|
||||||
{
|
if (modSize != 0)
|
||||||
baseData.Slice(dstOffset, baseSize).CopyTo(result.Slice(dstOffset, baseSize));
|
{
|
||||||
srcOffset += baseSize;
|
modData.Slice(dstOffset, modSize).CopyTo(result.Slice(dstOffset, modSize));
|
||||||
dstOffset += baseSize;
|
srcOffset += modSize;
|
||||||
}
|
dstOffset += modSize;
|
||||||
|
}
|
||||||
int modSize = Math.Min(rangeEnd - srcOffset, endOffset - srcOffset);
|
|
||||||
if (modSize != 0)
|
|
||||||
{
|
|
||||||
modData.Slice(dstOffset, modSize).CopyTo(result.Slice(dstOffset, modSize));
|
|
||||||
srcOffset += modSize;
|
|
||||||
dstOffset += modSize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1691,6 +1691,11 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_renderPass == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var pipeline = pbp == PipelineBindPoint.Compute
|
var pipeline = pbp == PipelineBindPoint.Compute
|
||||||
? _newState.CreateComputePipeline(Gd, Device, _program, PipelineCache)
|
? _newState.CreateComputePipeline(Gd, Device, _program, PipelineCache)
|
||||||
: _newState.CreateGraphicsPipeline(Gd, Device, _program, PipelineCache, _renderPass.Get(Cbs).Value);
|
: _newState.CreateGraphicsPipeline(Gd, Device, _program, PipelineCache, _renderPass.Get(Cbs).Value);
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetDescriptors != null)
|
if (SetDescriptors != null && other.SetDescriptors != null)
|
||||||
{
|
{
|
||||||
if (SetDescriptors.Count != other.SetDescriptors.Count)
|
if (SetDescriptors.Count != other.SetDescriptors.Count)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
private void FreeCompletedManualDescriptorSets()
|
private void FreeCompletedManualDescriptorSets()
|
||||||
{
|
{
|
||||||
FenceHolder signalledFence = null;
|
FenceHolder signalledFence = null;
|
||||||
while (_pendingManualDsConsumptions.TryPeek(out var pds) && (pds.Fence == signalledFence || pds.Fence.IsSignaled()))
|
while (_pendingManualDsConsumptions.TryPeek(out var pds) && pds.Fence != null && (pds.Fence == signalledFence || pds.Fence.IsSignaled()))
|
||||||
{
|
{
|
||||||
signalledFence = pds.Fence; // Already checked - don't need to do it again.
|
signalledFence = pds.Fence; // Already checked - don't need to do it again.
|
||||||
var dequeued = _pendingManualDsConsumptions.Dequeue();
|
var dequeued = _pendingManualDsConsumptions.Dequeue();
|
||||||
|
|
|
||||||
|
|
@ -134,14 +134,18 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
// Register this render pass with all render target views.
|
// Register this render pass with all render target views.
|
||||||
|
|
||||||
var textures = fb.GetAttachmentViews();
|
if (fb != null)
|
||||||
|
|
||||||
foreach (var texture in textures)
|
|
||||||
{
|
{
|
||||||
texture.AddRenderPass(key, this);
|
var textures = fb.GetAttachmentViews();
|
||||||
|
|
||||||
|
foreach (var texture in textures)
|
||||||
|
{
|
||||||
|
texture.AddRenderPass(key, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_textures = textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
_textures = textures;
|
|
||||||
_key = key;
|
_key = key;
|
||||||
|
|
||||||
_forcedFences = [];
|
_forcedFences = [];
|
||||||
|
|
|
||||||
|
|
@ -544,7 +544,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
pipeline.StagesCount = 1;
|
pipeline.StagesCount = 1;
|
||||||
pipeline.PipelineLayout = PipelineLayout;
|
pipeline.PipelineLayout = PipelineLayout;
|
||||||
|
|
||||||
pipeline.CreateComputePipeline(_gd, _device, this, (_gd.Pipeline as PipelineBase).PipelineCache);
|
pipeline.CreateComputePipeline(_gd, _device, this, ((PipelineBase)_gd.Pipeline).PipelineCache);
|
||||||
pipeline.Dispose();
|
pipeline.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -573,7 +573,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
pipeline.StagesCount = (uint)_shaders.Length;
|
pipeline.StagesCount = (uint)_shaders.Length;
|
||||||
pipeline.PipelineLayout = PipelineLayout;
|
pipeline.PipelineLayout = PipelineLayout;
|
||||||
|
|
||||||
pipeline.CreateGraphicsPipeline(_gd, _device, this, (_gd.Pipeline as PipelineBase).PipelineCache, renderPass.Value, throwOnError: true);
|
pipeline.CreateGraphicsPipeline(_gd, _device, this, ((PipelineBase)_gd.Pipeline).PipelineCache, renderPass.Value, throwOnError: true);
|
||||||
pipeline.Dispose();
|
pipeline.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
public void FreeCompleted()
|
public void FreeCompleted()
|
||||||
{
|
{
|
||||||
FenceHolder signalledFence = null;
|
FenceHolder signalledFence = null;
|
||||||
while (_pendingCopies.TryPeek(out var pc) && (pc.Fence == signalledFence || pc.Fence.IsSignaled()))
|
while (_pendingCopies.TryPeek(out var pc) && pc.Fence != null && (pc.Fence == signalledFence || pc.Fence.IsSignaled()))
|
||||||
{
|
{
|
||||||
signalledFence = pc.Fence; // Already checked - don't need to do it again.
|
signalledFence = pc.Fence; // Already checked - don't need to do it again.
|
||||||
var dequeued = _pendingCopies.Dequeue();
|
var dequeued = _pendingCopies.Dequeue();
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
internal KProcess Process => Device.System?.DebugGetApplicationProcess();
|
internal KProcess Process => Device.System?.DebugGetApplicationProcess();
|
||||||
internal IDebuggableProcess DebugProcess => Device.System?.DebugGetApplicationProcessDebugInterface();
|
internal IDebuggableProcess DebugProcess => Device.System?.DebugGetApplicationProcessDebugInterface();
|
||||||
private KThread[] GetThreads() => DebugProcess.GetThreadUids().Select(x => DebugProcess.GetThread(x)).ToArray();
|
private KThread[] GetThreads() => DebugProcess.GetThreadUids().Select(x => DebugProcess.GetThread(x)).ToArray();
|
||||||
internal bool IsProcessAarch32 => DebugProcess.GetThread(gThread.Value).Context.IsAarch32;
|
internal bool IsProcessAarch32 => gThread != null && DebugProcess.GetThread(gThread.Value).Context.IsAarch32;
|
||||||
private KernelContext KernelContext => Device.System.KernelContext;
|
private KernelContext KernelContext => Device.System.KernelContext;
|
||||||
|
|
||||||
const int GdbRegisterCount64 = 68;
|
const int GdbRegisterCount64 = 68;
|
||||||
|
|
|
||||||
|
|
@ -1099,7 +1099,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
|
||||||
}
|
}
|
||||||
if (!IPAddress.TryParse(ldnServer, out IPAddress ipAddress))
|
if (!IPAddress.TryParse(ldnServer, out IPAddress ipAddress))
|
||||||
{
|
{
|
||||||
ipAddress = Dns.GetHostEntry(ldnServer).AddressList[0];
|
ipAddress = Dns.GetHostEntry(ldnServer ?? string.Empty).AddressList[0];
|
||||||
}
|
}
|
||||||
NetworkClient = new LdnMasterProxyClient(ipAddress.ToString(), LanPlayPort, context.Device.Configuration);
|
NetworkClient = new LdnMasterProxyClient(ipAddress.ToString(), LanPlayPort, context.Device.Configuration);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
|
||||||
// Attempt to find matching configuration. If we don't find one, wait for a bit and try again.
|
// Attempt to find matching configuration. If we don't find one, wait for a bit and try again.
|
||||||
// Woken by new tokens coming in from the master server.
|
// Woken by new tokens coming in from the master server.
|
||||||
|
|
||||||
IPAddress address = (session.Socket.RemoteEndPoint as IPEndPoint).Address;
|
IPAddress address = (session.Socket.RemoteEndPoint as IPEndPoint)?.Address;
|
||||||
byte[] addressBytes = ProxyHelpers.AddressTo16Byte(address);
|
byte[] addressBytes = ProxyHelpers.AddressTo16Byte(address);
|
||||||
|
|
||||||
long time;
|
long time;
|
||||||
|
|
@ -282,7 +282,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
|
||||||
// Allow any client that has a private IP to connect. (indicated by the server as all 0 in the token)
|
// Allow any client that has a private IP to connect. (indicated by the server as all 0 in the token)
|
||||||
|
|
||||||
bool isPrivate = waitToken.PhysicalIp.AsSpan().SequenceEqual(new byte[16]);
|
bool isPrivate = waitToken.PhysicalIp.AsSpan().SequenceEqual(new byte[16]);
|
||||||
bool ipEqual = isPrivate || waitToken.AddressFamily == address.AddressFamily && waitToken.PhysicalIp.AsSpan().SequenceEqual(addressBytes);
|
bool ipEqual = address != null && (isPrivate || waitToken.AddressFamily == address.AddressFamily && waitToken.PhysicalIp.AsSpan().SequenceEqual(addressBytes));
|
||||||
|
|
||||||
if (ipEqual && waitToken.Token.AsSpan().SequenceEqual(config.Token.AsSpan()))
|
if (ipEqual && waitToken.Token.AsSpan().SequenceEqual(config.Token.AsSpan()))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@ namespace Ryujinx.Ava.UI.Controls
|
||||||
|
|
||||||
private void SearchBox_OnKeyUp(object sender, KeyEventArgs args)
|
private void SearchBox_OnKeyUp(object sender, KeyEventArgs args)
|
||||||
{
|
{
|
||||||
(DataContext as MainWindowViewModel).SearchText = (sender as TextBox)?.Text;
|
if (DataContext is MainWindowViewModel model)
|
||||||
|
{
|
||||||
|
model.SearchText = (sender as TextBox)?.Text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,10 @@ namespace Ryujinx.Ava.UI.Controls
|
||||||
|
|
||||||
private void SearchBox_OnKeyUp(object sender, KeyEventArgs args)
|
private void SearchBox_OnKeyUp(object sender, KeyEventArgs args)
|
||||||
{
|
{
|
||||||
(DataContext as MainWindowViewModel).SearchText = (sender as TextBox)?.Text;
|
if (DataContext is MainWindowViewModel model)
|
||||||
|
{
|
||||||
|
model.SearchText = (sender as TextBox)?.Text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void IdString_OnClick(object sender, RoutedEventArgs e)
|
private async void IdString_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue