Skip to content

Commit

Permalink
Follow up to FreeRDP#7832: Add NULL checks
Browse files Browse the repository at this point in the history
  • Loading branch information
akallabeth committed Apr 27, 2022
1 parent a005472 commit 8b9ab80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
20 changes: 14 additions & 6 deletions client/X11/xf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,22 +910,27 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,

if (status)
{
appWindow->maxVert = FALSE;
appWindow->maxHorz = FALSE;
if (appWindow)
{
appWindow->maxVert = FALSE;
appWindow->maxHorz = FALSE;
}
for (i = 0; i < nitems; i++)
{
if ((Atom)((UINT16**)prop)[i] ==
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
{
maxVert = TRUE;
appWindow->maxVert = TRUE;
if (appWindow)
appWindow->maxVert = TRUE;
}

if ((Atom)((UINT16**)prop)[i] ==
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False))
{
maxHorz = TRUE;
appWindow->maxHorz = TRUE;
if (appWindow)
appWindow->maxHorz = TRUE;
}
}

Expand All @@ -944,12 +949,14 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
if (((UINT32)*prop == 3))
{
minimized = TRUE;
appWindow->minimized = TRUE;
if (appWindow)
appWindow->minimized = TRUE;
}
else
{
minimized = FALSE;
appWindow->minimized = FALSE;
if (appWindow)
appWindow->minimized = FALSE;
}

minimizedChanged = TRUE;
Expand All @@ -959,6 +966,7 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,

if (app)
{
WINPR_ASSERT(appWindow);
if (appWindow->maxVert && appWindow->maxHorz && !appWindow->minimized)
{
if(appWindow->rail_state != WINDOW_SHOW_MAXIMIZED)
Expand Down
3 changes: 3 additions & 0 deletions client/X11/xf_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,9 @@ void xf_MoveWindow(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int wid

void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
{
WINPR_ASSERT(xfc);
WINPR_ASSERT(appWindow);

switch (state)
{
case WINDOW_HIDE:
Expand Down

0 comments on commit 8b9ab80

Please sign in to comment.