We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 764

Summary: SDL_Video patch for better error reporting
Product: SDL Reporter: Mason Wheeler <masonwheeler>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Windows Vista   

Description Mason Wheeler 2009-07-06 11:14:06 UTC
This patch comes from the same codebase as the patch submitted in error #761, so some line numbers may be off if it hasn't been added yet.


Index: SDL_video.c
===================================================================
--- SDL_video.c	(revision 4599)
+++ SDL_video.c	(working copy)
@@ -2440,11 +2438,17 @@
     SDL_Rect real_srcrect;
     SDL_Rect real_dstrect;
 
-    if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
+	if (!texture) {
+		SDL_SetError("Texture not found.");
+		return -1;
+	}
+	else if (texture->renderer != SDL_CurrentDisplay.current_renderer) {
+		SDL_SetError("Texture was not created with this renderer.");
         return -1;
     }
     renderer = SDL_CurrentDisplay.current_renderer;
     if (!renderer) {
+		SDL_SetError("No renderer found for this texture.");
         return -1;
     }
     if (!renderer->RenderCopy) {
Comment 1 Sam Lantinga 2009-09-26 03:18:04 UTC
This fix is in subversion, thanks!