Fixed bug #766
authorSam Lantinga <slouken@libsdl.org>
Sat, 26 Sep 2009 10:22:35 +0000
changeset 3318f085091f74cd
parent 3317 b29eb7ce5352
child 3319 63d4517fc4ac
Fixed bug #766

Mason Wheeler 2009-07-06 14:29:47 PDT

This adds some missing error reporting for SDL_SelectRenderer, and cleans up the logic a little bit.
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Sat Sep 26 10:19:19 2009 +0000
     1.2 +++ b/src/video/SDL_video.c	Sat Sep 26 10:22:35 2009 +0000
     1.3 @@ -1501,11 +1501,16 @@
     1.4      SDL_Window *window = SDL_GetWindowFromID(windowID);
     1.5      SDL_Renderer *renderer;
     1.6  
     1.7 -    if (!window || !window->renderer) {
     1.8 +    if (!window) {
     1.9 +        SDL_SetError("Invalid window ID");
    1.10          return -1;
    1.11      }
    1.12      renderer = window->renderer;
    1.13 -    if (renderer && renderer->ActivateRenderer) {
    1.14 +    if (!renderer) {
    1.15 +        SDL_SetError("Renderer hasn't been created yet");
    1.16 +        return -1;
    1.17 +    }
    1.18 +    if (renderer->ActivateRenderer) {
    1.19          if (renderer->ActivateRenderer(renderer) < 0) {
    1.20              return -1;
    1.21          }