Skip to content

Commit

Permalink
Merge pull request #393 from Noisrev/master
Browse files Browse the repository at this point in the history
Add Null check for GetWindowChrome
  • Loading branch information
Dirkster99 authored Nov 4, 2022
2 parents d0bbe39 + e77aaaf commit 3ddbf2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,12 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int
case Win32Helper.WM_NCRBUTTONUP:
if (wParam.ToInt32() == Win32Helper.HT_CAPTION)
{
if (OpenContextMenu()) handled = true;
WindowChrome.GetWindowChrome(this).ShowSystemMenu = _model.Root.Manager.ShowSystemMenu && !handled;
var windowChrome = WindowChrome.GetWindowChrome(this);
if (windowChrome != null)
{
if (OpenContextMenu()) handled = true;
windowChrome.ShowSystemMenu = _model.Root.Manager.ShowSystemMenu && !handled;
}
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,17 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int
case Win32Helper.WM_NCRBUTTONUP:
if (wParam.ToInt32() == Win32Helper.HT_CAPTION)
{
if (OpenContextMenu())
handled = true;
if (_model.Root.Manager.ShowSystemMenu)
WindowChrome.GetWindowChrome(this).ShowSystemMenu = !handled;
else
WindowChrome.GetWindowChrome(this).ShowSystemMenu = false;
var windowChrome = WindowChrome.GetWindowChrome(this);
if (windowChrome != null)
{
if (OpenContextMenu())
handled = true;

if (_model.Root.Manager.ShowSystemMenu)
windowChrome.ShowSystemMenu = !handled;
else
windowChrome.ShowSystemMenu = false;
}
}
break;

Expand Down

0 comments on commit 3ddbf2f

Please sign in to comment.