xcbgrab: Move NULL check before pointer dereference

Bug-Id: CID 1254668
pull/101/head
Vittorio Giovara 10 years ago
parent 5ac06633cb
commit 9e06327ecb
  1. 6
      libavdevice/xcbgrab.c

@ -99,12 +99,16 @@ static int xcbgrab_reposition(AVFormatContext *s,
xcb_get_geometry_reply_t *geo) xcb_get_geometry_reply_t *geo)
{ {
XCBGrabContext *c = s->priv_data; XCBGrabContext *c = s->priv_data;
int x = c->x, y = c->y, p_x = p->win_x, p_y = p->win_y; int x = c->x, y = c->y;
int w = c->width, h = c->height, f = c->follow_mouse; int w = c->width, h = c->height, f = c->follow_mouse;
int p_x, p_y;
if (!p || !geo) if (!p || !geo)
return AVERROR(EIO); return AVERROR(EIO);
p_x = p->win_x;
p_y = p->win_y;
if (f == FOLLOW_CENTER) { if (f == FOLLOW_CENTER) {
x = p_x - w / 2; x = p_x - w / 2;
y = p_y - h / 2; y = p_y - h / 2;

Loading…
Cancel
Save