Skip to content

Commit

Permalink
Fix Crash-on-Start
Browse files Browse the repository at this point in the history
  • Loading branch information
parzival-space committed Apr 21, 2024
1 parent 3967f2e commit 4ec2fda
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions FaderSyncPlugin/OBS/GoXlrChannelSyncFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,20 @@ private static unsafe void Tick(void* data, float seconds)

// check if channel is muted
bool isMuted = false;
JsonObject faderStatus = (JsonObject) utility.Status?["mixers"]?[deviceSerial ?? ""]?["fader_status"]!;

foreach (var faderEntry in faderStatus)
JsonObject? faderStatus = (JsonObject) utility.Status?["mixers"]?[deviceSerial ?? ""]?["fader_status"];

Check warning on line 120 in FaderSyncPlugin/OBS/GoXlrChannelSyncFilter.cs

View workflow job for this annotation

GitHub Actions / Build for Linux

Converting null literal or possible null value to non-nullable type.

Check warning on line 120 in FaderSyncPlugin/OBS/GoXlrChannelSyncFilter.cs

View workflow job for this annotation

GitHub Actions / Build for Windows

Converting null literal or possible null value to non-nullable type.

Check warning on line 120 in FaderSyncPlugin/OBS/GoXlrChannelSyncFilter.cs

View workflow job for this annotation

GitHub Actions / build / Build for Linux

Converting null literal or possible null value to non-nullable type.

Check warning on line 120 in FaderSyncPlugin/OBS/GoXlrChannelSyncFilter.cs

View workflow job for this annotation

GitHub Actions / build / Build for Windows

Converting null literal or possible null value to non-nullable type.

Check warning on line 120 in FaderSyncPlugin/OBS/GoXlrChannelSyncFilter.cs

View workflow job for this annotation

GitHub Actions / Build for Linux

Converting null literal or possible null value to non-nullable type.

Check warning on line 120 in FaderSyncPlugin/OBS/GoXlrChannelSyncFilter.cs

View workflow job for this annotation

GitHub Actions / Build for Windows

Converting null literal or possible null value to non-nullable type.
if (faderStatus != null)
{
if (faderEntry.Value?["channel"]?.GetValue<string>() != channelName) continue;
foreach (var faderEntry in faderStatus)
{
if (faderEntry.Value?["channel"]?.GetValue<string>() != channelName) continue;

isMuted = faderEntry.Value?["mute_state"]?.GetValue<string>() == "MutedToAll" ||
(faderEntry.Value?["mute_state"]?.GetValue<string>() == "MutedToX" &&
faderEntry.Value?["mute_type"]?.GetValue<string>() == "ToStream");
break;
isMuted = faderEntry.Value?["mute_state"]?.GetValue<string>() == "MutedToAll" ||
(faderEntry.Value?["mute_state"]?.GetValue<string>() == "MutedToX" &&
faderEntry.Value?["mute_type"]?.GetValue<string>() == "ToStream");
break;
}
}


// Update OBS Volume
Obs.obs_source_set_volume(target, obsVolume);
Obs.obs_source_set_muted(target, isMuted ? (byte)1 : (byte)0);
Expand Down

0 comments on commit 4ec2fda

Please sign in to comment.