Fix crash when object not ready
This commit is contained in:
parent
de1a99c501
commit
5b08f9138b
@ -52,7 +52,15 @@ public class DisMediaRP : IDisposable
|
|||||||
|
|
||||||
if (this._mediaManager.GetFocusedSession() is not null)
|
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.PlaybackStateChanged(this._mediaManager.GetFocusedSession(), this._mediaManager.GetFocusedSession().ControlSession.GetPlaybackInfo());
|
||||||
this.TimelinePropertyChanged(this._mediaManager.GetFocusedSession(), this._mediaManager.GetFocusedSession().ControlSession.GetTimelineProperties());
|
this.TimelinePropertyChanged(this._mediaManager.GetFocusedSession(), this._mediaManager.GetFocusedSession().ControlSession.GetTimelineProperties());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user