changeset 3316:9cf18687b761

Fixed bug #764 Added better error checking from Mason Wheeler
author Sam Lantinga <slouken@libsdl.org>
date Sat, 26 Sep 2009 10:17:49 +0000
parents 87ffdad11607
children b29eb7ce5352
files src/video/SDL_video.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_video.c	Sat Sep 26 10:13:44 2009 +0000
+++ b/src/video/SDL_video.c	Sat Sep 26 10:17:49 2009 +0000
@@ -2417,11 +2417,17 @@
     SDL_Rect real_srcrect;
     SDL_Rect real_dstrect;
 
-    if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
+    renderer = SDL_CurrentDisplay.current_renderer;
+    if (!renderer) {
+        SDL_SetError("No current renderer available");
         return -1;
     }
-    renderer = SDL_CurrentDisplay.current_renderer;
-    if (!renderer) {
+    if (!texture) {
+        SDL_SetError("Texture not found");
+        return -1;
+    }
+    if (texture->renderer != renderer) {
+        SDL_SetError("Texture was not created with this renderer");
         return -1;
     }
     if (!renderer->RenderCopy) {