diff --git a/FlyleafLib/Controls/WPF/FlyleafWindow.cs b/FlyleafLib/Controls/WPF/FlyleafWindow.cs index fc343355..777940f9 100644 --- a/FlyleafLib/Controls/WPF/FlyleafWindow.cs +++ b/FlyleafLib/Controls/WPF/FlyleafWindow.cs @@ -98,6 +98,8 @@ void WFH_Loaded(object sender, RoutedEventArgs e) public void Wndhost_LocationChanged(object sender, EventArgs e) { //Console.WriteLine("Wndhost_LocationChanged"); + if (WindowBack == null) return; + var locationFromScreen = windowsFormsHost.PointToScreen(_zeroPoint); var source = PresentationSource.FromVisual(WindowBack); var targetPoints = source.CompositionTarget.TransformFromDevice.Transform(locationFromScreen); diff --git a/FlyleafLib/MediaPlayer/Player.cs b/FlyleafLib/MediaPlayer/Player.cs index 33a7c09b..cfa8af1c 100644 --- a/FlyleafLib/MediaPlayer/Player.cs +++ b/FlyleafLib/MediaPlayer/Player.cs @@ -373,7 +373,7 @@ public void Open(StreamBase inputStream) else if (inputStream is AudioStream) { Utils.EnsureThreadDone(tOpenAudio); - Session.CurAudioStream.InUse = false; + if (Session.CurAudioStream != null) Session.CurAudioStream.InUse = false; if (Config.audio.Enabled == false) Config.audio.SetEnabled(); tOpenAudio = new Thread(() => { OpenAudio((AudioStream)inputStream); }); @@ -382,7 +382,7 @@ public void Open(StreamBase inputStream) else if (inputStream is SubtitlesStream) { Utils.EnsureThreadDone(tOpenSubs); - Session.CurSubtitleStream.InUse = false; + if (Session.CurSubtitleStream != null) Session.CurSubtitleStream.InUse = false; Session.SubsText = null; sFrame = null; if (Config.subs.Enabled == false) Config.subs.SetEnabled();