mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 20:44:20 +01:00
Change methods to check for null thread objects
It looks like there are cases when the stop update methods could be called before the thread objecs are created
This commit is contained in:
parent
8df30a5bbb
commit
ade55d3b9f
@ -397,7 +397,8 @@ namespace DS4Windows
|
||||
|
||||
public void StopUpdate()
|
||||
{
|
||||
if (ds4Input.IsAlive && !ds4Input.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
||||
if (ds4Input != null &&
|
||||
ds4Input.IsAlive && !ds4Input.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
||||
!ds4Input.ThreadState.HasFlag(System.Threading.ThreadState.AbortRequested))
|
||||
{
|
||||
try
|
||||
@ -418,7 +419,8 @@ namespace DS4Windows
|
||||
{
|
||||
lock (exitLocker)
|
||||
{
|
||||
if (ds4Output.IsAlive && !ds4Output.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
||||
if (ds4Output != null &&
|
||||
ds4Output.IsAlive && !ds4Output.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
||||
!ds4Output.ThreadState.HasFlag(System.Threading.ThreadState.AbortRequested))
|
||||
{
|
||||
try
|
||||
|
@ -81,6 +81,7 @@ namespace DS4Windows
|
||||
if (isExclusiveMode && !hDevice.IsOpen)
|
||||
hDevice.OpenDevice(false);
|
||||
}
|
||||
|
||||
if (hDevice.IsOpen)
|
||||
{
|
||||
string serial = hDevice.readSerial();
|
||||
|
Loading…
Reference in New Issue
Block a user