[gnome-color-manager] Better error handling in gcm_utils_get_gamma_size()



commit 45aaca7db35ed92ef6101fd310059c650b0fa0bf
Author: Richard Hughes <richard hughsie com>
Date:   Wed Nov 4 15:28:35 2009 +0000

    Better error handling in gcm_utils_get_gamma_size()

 src/gcm-utils.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 66ba105..eb76ac9 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -135,8 +135,11 @@ gcm_utils_get_gamma_size (GnomeRRCrtc *crtc, GError **error)
 	/* get the value, and catch errors */
 	gdk_error_trap_push ();
 	size = XRRGetCrtcGammaSize (GDK_DISPLAY(), id);
-	if (gdk_error_trap_pop ()) {
+	if (gdk_error_trap_pop ())
 		size = 0;
+
+	/* no size, or X popped an error */
+	if (size == 0) {
 		if (error != NULL)
 			*error = g_error_new (1, 0, "failed to get gamma size");
 		goto out;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]