directfb: Fixed crash if creating renderer.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 11 Jun 2017 22:30:24 +0200
changeset 110914f02bf4b6d75
parent 11090 d85832ad10c3
child 11092 9c9b7b7e46e1
directfb: Fixed crash if creating renderer.

SDL_GetWindowWMInfo() currently expects SDL to be 2.0.6 but SDL is still 2.0.5.
src/video/directfb/SDL_DirectFB_render.c
     1.1 --- a/src/video/directfb/SDL_DirectFB_render.c	Sun Jun 11 22:30:06 2017 +0200
     1.2 +++ b/src/video/directfb/SDL_DirectFB_render.c	Sun Jun 11 22:30:24 2017 +0200
     1.3 @@ -217,7 +217,9 @@
     1.4      SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo));
     1.5  
     1.6      SDL_VERSION(&wm_info.version);
     1.7 -    SDL_GetWindowWMInfo(window, &wm_info);
     1.8 +    if (!SDL_GetWindowWMInfo(window, &wm_info)) {
     1.9 +        return NULL;
    1.10 +    }
    1.11  
    1.12      return wm_info.info.dfb.surface;
    1.13  }
    1.14 @@ -228,7 +230,9 @@
    1.15      SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo));
    1.16  
    1.17      SDL_VERSION(&wm_info.version);
    1.18 -    SDL_GetWindowWMInfo(window, &wm_info);
    1.19 +    if (!SDL_GetWindowWMInfo(window, &wm_info)) {
    1.20 +        return NULL;
    1.21 +    }
    1.22  
    1.23      return wm_info.info.dfb.window;
    1.24  }
    1.25 @@ -356,6 +360,10 @@
    1.26      DirectFB_RenderData *data = NULL;
    1.27      DFBSurfaceCapabilities scaps;
    1.28  
    1.29 +    if (!winsurf) {
    1.30 +        return NULL;
    1.31 +    }
    1.32 +
    1.33      SDL_DFB_ALLOC_CLEAR(renderer, sizeof(*renderer));
    1.34      SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
    1.35