fix: dereference of a possibly null reference.

This commit is contained in:
ParantezTech
2026-03-16 21:19:49 +03:00
parent 0ede7c70a9
commit cecf55bf2e
2 changed files with 5 additions and 3 deletions
@@ -3,6 +3,7 @@
using SharpEmu.HLE; using SharpEmu.HLE;
using System.Threading; using System.Threading;
using System.Diagnostics.CodeAnalysis;
namespace SharpEmu.Libs.Kernel; namespace SharpEmu.Libs.Kernel;
@@ -606,7 +607,7 @@ public static class KernelPthreadCompatExports
return mutexAddress; return mutexAddress;
} }
private static bool TryResolveMutexState(CpuContext ctx, ulong mutexAddress, bool createIfZero, out ulong resolvedAddress, out PthreadMutexState? state) private static bool TryResolveMutexState(CpuContext ctx, ulong mutexAddress, bool createIfZero, out ulong resolvedAddress, [NotNullWhen(true)] out PthreadMutexState? state)
{ {
resolvedAddress = 0; resolvedAddress = 0;
state = null; state = null;
@@ -739,7 +740,7 @@ public static class KernelPthreadCompatExports
return condAddress; return condAddress;
} }
private static bool TryResolveCondState(CpuContext? ctx, ulong condAddress, bool createIfZero, out ulong resolvedAddress, out PthreadCondState? state) private static bool TryResolveCondState(CpuContext? ctx, ulong condAddress, bool createIfZero, out ulong resolvedAddress, [NotNullWhen(true)] out PthreadCondState? state)
{ {
resolvedAddress = 0; resolvedAddress = 0;
state = null; state = null;
@@ -5,6 +5,7 @@ using SharpEmu.HLE;
using System.Buffers.Binary; using System.Buffers.Binary;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Diagnostics.CodeAnalysis;
namespace SharpEmu.Libs.Kernel; namespace SharpEmu.Libs.Kernel;
@@ -928,7 +929,7 @@ public static class KernelPthreadExtendedCompatExports
return rwlockAddress; return rwlockAddress;
} }
private static bool TryResolveRwlockState(CpuContext ctx, ulong rwlockAddress, bool createIfZero, out ulong resolvedAddress, out ReaderWriterLockSlim? rwlock) private static bool TryResolveRwlockState(CpuContext ctx, ulong rwlockAddress, bool createIfZero, out ulong resolvedAddress, [NotNullWhen(true)] out ReaderWriterLockSlim? rwlock)
{ {
resolvedAddress = 0; resolvedAddress = 0;
rwlock = null; rwlock = null;