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 766 - Yet another error-reporting fix
Summary: Yet another error-reporting fix
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Windows Vista
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-06 14:29 UTC by Mason Wheeler
Modified: 2009-09-26 03:22 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mason Wheeler 2009-07-06 14:29:47 UTC
This adds some missing error reporting for SDL_SelectRenderer, and cleans up the logic a little bit.

Index: SDL_video.c
===================================================================
--- SDL_video.c	(revision 4599)
+++ SDL_video.c	(working copy)
@@ -1522,11 +1522,16 @@
     SDL_Window *window = SDL_GetWindowFromID(windowID);
     SDL_Renderer *renderer;
 
-    if (!window || !window->renderer) {
+	if (!window) {
+		SDL_SetError("Window doesn't exist.");
+		return -1;
+	}
+    renderer = window->renderer;
+	if (!renderer) {
+		SDL_SetError("Renderer has't been created.");
         return -1;
     }
-    renderer = window->renderer;
-    if (renderer && renderer->ActivateRenderer) {
+    if (renderer->ActivateRenderer) {
         if (renderer->ActivateRenderer(renderer) < 0) {
             return -1;
         }
Comment 1 Sam Lantinga 2009-09-26 03:22:46 UTC
Fixed in subversion, thanks!