diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index 57f40d1a9..85dff203a 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/src/video/directfb/SDL_DirectFB_video.c @@ -1075,14 +1075,21 @@ int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) void DirectFB_VideoQuit(_THIS) { struct DirectFBEnumRect *rect = enumlist; - IDirectFBSurface *surface = this->screen->hwdata->surface; - IDirectFBPalette *palette = this->screen->hwdata->palette; - if (palette) - palette->Release (palette); + if (this->screen->hwdata) + { + IDirectFBSurface *surface = this->screen->hwdata->surface; + IDirectFBPalette *palette = this->screen->hwdata->palette; - if (surface) - surface->Release (surface); + if (palette) + palette->Release (palette); + + if (surface) + surface->Release (surface); + + this->screen->hwdata->surface = NULL; + this->screen->hwdata->palette = NULL; + } if (HIDDEN->c2frame) {