Commit d39de069 authored by Martin Finkel's avatar Martin Finkel

WPF: Guard against null visual in rare occasions

In unusual configurations, the source result may be null.
#384
parent 1ea8e0de
......@@ -102,8 +102,13 @@ namespace LibVLCSharp.WPF
void Wndhost_SizeChanged(object sender, SizeChangedEventArgs e)
{
var locationFromScreen = _bckgnd.PointToScreen(_zeroPoint);
var source = PresentationSource.FromVisual(_wndhost);
if (source == null)
{
return;
}
var locationFromScreen = _bckgnd.PointToScreen(_zeroPoint);
var targetPoints = source.CompositionTarget.TransformFromDevice.Transform(locationFromScreen);
Left = targetPoints.X;
Top = targetPoints.Y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment