1
0

Fix crash when object not ready

This commit is contained in:
glax 2024-02-22 03:46:19 +01:00
parent de1a99c501
commit 5b08f9138b

View File

@ -52,7 +52,15 @@ public class DisMediaRP : IDisposable
if (this._mediaManager.GetFocusedSession() is not null)
{
this.MediaPropertyChanged(this._mediaManager.GetFocusedSession(), this._mediaManager.GetFocusedSession().ControlSession.TryGetMediaPropertiesAsync().GetResults());
try
{
this.MediaPropertyChanged(this._mediaManager.GetFocusedSession(),
this._mediaManager.GetFocusedSession().ControlSession.TryGetMediaPropertiesAsync().GetResults());
}
catch (System.Runtime.InteropServices.COMException e)
{
this._logger?.LogError("Could not fetch MediaProperties\n{e}", e);
}
this.PlaybackStateChanged(this._mediaManager.GetFocusedSession(), this._mediaManager.GetFocusedSession().ControlSession.GetPlaybackInfo());
this.TimelinePropertyChanged(this._mediaManager.GetFocusedSession(), this._mediaManager.GetFocusedSession().ControlSession.GetTimelineProperties());
}