Skip to content

Commit

Permalink
Attempt to fix service "soft crashes", part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparronator9999 committed Sep 7, 2024
1 parent 110e086 commit ff91b6c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions YAMDCC.Service/svcFanControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ private int WriteECByte(string name, string args)

private int GetFanSpeed(string name, string args)
{
if (!ConfigLoaded)
{
return 0;
}

if (ParseArgs(args, 1, out int[] pArgs))
{
if (EC.AcquireLock(1000))
Expand All @@ -481,6 +486,11 @@ private int GetFanSpeed(string name, string args)

private int GetFanRPM(string name, string args)
{
if (!ConfigLoaded)
{
return 0;
}

if (ParseArgs(args, 1, out int[] pArgs))
{
FanConf cfg = Config.FanConfs[pArgs[0]];
Expand Down Expand Up @@ -548,6 +558,11 @@ private int GetFanRPM(string name, string args)

private int GetTemp(string name, string args)
{
if (!ConfigLoaded)
{
return 0;
}

if (ParseArgs(args, 1, out int[] pArgs))
{
if (EC.AcquireLock(1000))
Expand All @@ -573,7 +588,7 @@ private int GetTemp(string name, string args)

private int SetFullBlast(string name, string args)
{
if (Config.FullBlastConf is not null)
if (ConfigLoaded && Config.FullBlastConf is not null)
{
if (ParseArgs(args, 1, out int[] pArgs))
{
Expand Down Expand Up @@ -609,7 +624,7 @@ private int SetFullBlast(string name, string args)

private int GetKeyLightBright(string name)
{
if (Config.KeyLightConf is null)
if (!ConfigLoaded || Config.KeyLightConf is null)
{
return 0;
}
Expand All @@ -636,7 +651,7 @@ private int GetKeyLightBright(string name)

private int SetKeyLightBright(string name, string args)
{
if (Config.KeyLightConf is null)
if (!ConfigLoaded || Config.KeyLightConf is null)
{
return 0;
}
Expand Down

0 comments on commit ff91b6c

Please sign in to comment.