libobs-opengl: Fix segfault on access of invalid window

Once a window is invalid gl-x11::get_window_geometry will return 0
so just check if the returned geometry is a valid pointer before
trying to get its width/height.
This commit is contained in:
Shaolin 2018-08-03 00:55:09 -03:00
parent 4a266dc920
commit 85c7669ad2

View File

@ -520,8 +520,10 @@ extern void gl_getclientsize(const struct gs_swap_chain *swap,
xcb_window_t window = swap->wi->window;
xcb_get_geometry_reply_t *geometry = get_window_geometry(xcb_conn, window);
*width = geometry->width;
*height = geometry->height;
if (geometry) {
*width = geometry->width;
*height = geometry->height;
}
free(geometry);
}