Fixed bug #766
authorSam Lantinga <slouken@libsdl.org>
Sat, 26 Sep 2009 10:22:35 +0000
changeset 3318 f085091f74cd
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
--- a/src/video/SDL_video.c	Sat Sep 26 10:19:19 2009 +0000
+++ b/src/video/SDL_video.c	Sat Sep 26 10:22:35 2009 +0000
@@ -1501,11 +1501,16 @@
     SDL_Window *window = SDL_GetWindowFromID(windowID);
     SDL_Renderer *renderer;
 
-    if (!window || !window->renderer) {
+    if (!window) {
+        SDL_SetError("Invalid window ID");
         return -1;
     }
     renderer = window->renderer;
-    if (renderer && renderer->ActivateRenderer) {
+    if (!renderer) {
+        SDL_SetError("Renderer hasn't been created yet");
+        return -1;
+    }
+    if (renderer->ActivateRenderer) {
         if (renderer->ActivateRenderer(renderer) < 0) {
             return -1;
         }