EGLBoolean
_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
{
- _EGLContext *cur;
+ _EGLContext *cur = NULL;
- cur = dpy->ContextList;
+ if (dpy)
+ cur = dpy->ContextList;
while (cur) {
if (cur == (_EGLContext *) ctx) {
assert(cur->Display == dpy);
EGLBoolean
_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
{
- _EGLSurface *cur;
+ _EGLSurface *cur = NULL;
- cur = dpy->SurfaceList;
+ if (dpy)
+ cur = dpy->SurfaceList;
while (cur) {
if (cur == (_EGLSurface *) surf) {
assert(cur->Display == 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);
}
_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
{
_EGLSurface *s = (_EGLSurface *) surf;
- return (s && s->Display == dpy);
+ return (dpy && s && s->Display == dpy);
}