Skip to content

Commit

Permalink
Preventing crashes when window has no PresentationSource
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Apr 26, 2023
1 parent c5033fb commit a4a57de
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ public bool ClickTrackedControl(IntPtr lParam)

public static DependencyObject? GetControlUnderMouse(Window owner, IntPtr lParam, out HT hitTestResult)
{
if (lParam == IntPtr.Zero)
if (lParam == IntPtr.Zero
|| PresentationSource.FromVisual(owner) is null)
{
hitTestResult = HT.NOWHERE;
return null;
Expand Down

0 comments on commit a4a57de

Please sign in to comment.