misc: chore: Fix numerous NullReferenceExceptions, InvalidOperationExceptions

This commit is contained in:
KeatonTheBot
2025-06-18 02:25:06 -05:00
parent a90db3464d
commit d2a532f971
90 changed files with 667 additions and 533 deletions
@@ -318,13 +318,16 @@ namespace Ryujinx.Common.Collections
{
Root = newNode;
}
else if (start.CompareTo(parent.Start) < 0)
else if (parent != null && start.CompareTo(parent.Start) < 0)
{
parent.Left = newNode;
}
else
{
parent.Right = newNode;
if (parent != null)
{
parent.Right = newNode;
}
}
PropagateIncrease(newNode);
@@ -279,13 +279,16 @@ namespace Ryujinx.Common.Collections
{
Root = newNode;
}
else if (key.CompareTo(parent.Key) < 0)
else if (parent != null && key.CompareTo(parent.Key) < 0)
{
parent.Left = newNode;
}
else
{
parent.Right = newNode;
if (parent != null)
{
parent.Right = newNode;
}
}
Count++;
return newNode;
@@ -273,7 +273,7 @@ namespace Ryujinx.Common.Configuration
{
FileSystemInfo resolvedDirectoryInfo =
Directory.ResolveLinkTarget(correctApplicationDataDirectoryPath, true);
string resolvedPath = resolvedDirectoryInfo.FullName;
string resolvedPath = resolvedDirectoryInfo?.FullName;
Logger.Error?.Print(LogClass.Application, $"Please manually move your Ryujinx data from {resolvedPath} to {correctApplicationDataDirectoryPath}, and remove the symlink.");
}
catch (Exception symlinkException)
@@ -297,7 +297,7 @@ namespace Ryujinx.Common.Configuration
{
FileSystemInfo resolvedDirectoryInfo =
Directory.ResolveLinkTarget(correctApplicationDataDirectoryPath, true);
string resolvedPath = resolvedDirectoryInfo.FullName;
string resolvedPath = resolvedDirectoryInfo?.FullName;
Logger.Error?.Print(LogClass.Application, $"Please manually move your Ryujinx data from {resolvedPath} to {correctApplicationDataDirectoryPath}, and remove the symlink.");
}
catch (Exception symlinkException)
@@ -25,7 +25,7 @@ namespace Ryujinx.Common.Configuration.Hid.Controller.Motion
{
string propertyName = tempReader.GetString();
if (propertyName.Equals("motion_backend"))
if (propertyName is "motion_backend")
{
tempReader.Read();
@@ -27,7 +27,7 @@ namespace Ryujinx.Common.Configuration.Hid
{
string propertyName = tempReader.GetString();
if (propertyName.Equals("backend"))
if (propertyName is "backend")
{
tempReader.Read();
+1 -1
View File
@@ -24,7 +24,7 @@ namespace Ryujinx.Common.Logging
public readonly struct Log
{
private static readonly string _homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
private static readonly string _homeDirRedacted = Path.Combine(Directory.GetParent(_homeDir).FullName, "[redacted]");
private static readonly string _homeDirRedacted = Path.Combine(Directory.GetParent(_homeDir)?.FullName ?? string.Empty, "[redacted]");
internal readonly LogLevel Level;