efl_ui_win: Fix dereference before NULL check

This patch fixes an issue detected by Coverity in that 'sdp' is
already being dereferenced before we check it. ELM_WIN_DATA_GET can
return NULL, so we should check it's return Before trying to use the
variable.

Fixes CID1419871
This commit is contained in:
Christopher Michael 2020-03-06 16:12:15 -05:00
parent 7c99e0a444
commit 8be14b2e6e
1 changed files with 6 additions and 3 deletions

View File

@ -59,7 +59,7 @@ static int _paused_windows = 0;
while (0)
#define ELM_WIN_DATA_GET(o, sd) \
Efl_Ui_Win_Data * sd = efl_data_scope_get(o, MY_CLASS)
Efl_Ui_Win_Data *sd = efl_data_scope_get(o, MY_CLASS)
#define ELM_WIN_DATA_GET_OR_RETURN(o, ptr, ...) \
ELM_WIN_DATA_GET(o, ptr); \
@ -3517,8 +3517,11 @@ _elm_win_xwin_update(Efl_Ui_Win_Data *sd)
if (sd->parent)
{
ELM_WIN_DATA_GET(sd->parent, sdp);
_internal_elm_win_xwindow_get(sdp);
if (sdp) ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin);
if (sdp)
{
_internal_elm_win_xwindow_get(sdp);
ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin);
}
}
}