prevent crash on launch

This commit is contained in:
dlprows 2023-09-30 19:28:25 -06:00
parent ca634f8d3c
commit 2b10b6d7a6

View File

@ -1,5 +1,6 @@
using BarRaider.SdTools; using BarRaider.SdTools;
using BarRaider.SdTools.Payloads; using BarRaider.SdTools.Payloads;
using FocusVolumeControl.AudioHelpers;
using FocusVolumeControl.AudioSessions; using FocusVolumeControl.AudioSessions;
using FocusVolumeControl.UI; using FocusVolumeControl.UI;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -49,9 +50,14 @@ public class DialAction : EncoderBase
WindowChangedEventLoop.Instance.WindowChanged += WindowChanged; WindowChangedEventLoop.Instance.WindowChanged += WindowChanged;
try
{
//just in case we fail to get the active session, don't prevent the plugin from launching
var session = _audioHelper.GetActiveSession(settings.FallbackBehavior); var session = _audioHelper.GetActiveSession(settings.FallbackBehavior);
_ = UpdateStateIfNeeded(session); _ = UpdateStateIfNeeded(session);
} }
catch { }
}
public override void Dispose() public override void Dispose()
{ {