egl: Check for null display in handle checking.

The display may be NULL when checking a handle.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
Chia-I Wu
2009-08-19 13:00:25 +08:00
committed by Brian Paul
parent 9b3e5df900
commit 408db29792
2 changed files with 12 additions and 7 deletions

View File

@@ -125,14 +125,17 @@ _eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy);
/* Only do a quick check. This is NOT standard compliant. */
static INLINE EGLBoolean
_eglCheckDisplayHandle(EGLDisplay dpy) { return EGL_TRUE; }
_eglCheckDisplayHandle(EGLDisplay dpy)
{
return ((_EGLDisplay *) dpy != NULL);
}
static INLINE EGLBoolean
_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
{
_EGLContext *c = (_EGLContext *) ctx;
return (c && c->Display == dpy);
return (dpy && c && c->Display == dpy);
}
@@ -140,7 +143,7 @@ static INLINE EGLBoolean
_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
{
_EGLSurface *s = (_EGLSurface *) surf;
return (s && s->Display == dpy);
return (dpy && s && s->Display == dpy);
}