[gnome-color-manager] trivial: add some assert checks to make sure we're not insane
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: add some assert checks to make sure we're not insane
- Date: Wed, 23 Dec 2009 22:04:25 +0000 (UTC)
commit 429246780858476709eb13401a25882971ad1e84
Author: Richard Hughes <richard hughsie com>
Date: Wed Dec 23 22:03:53 2009 +0000
trivial: add some assert checks to make sure we're not insane
src/gcm-prefs.c | 6 ++++++
src/gcm-utils.c | 11 +++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index e0fe445..e49314d 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -852,6 +852,12 @@ gcm_prefs_calibrate_cb (GtkWidget *widget, gpointer data)
"filename-result", &filename,
NULL);
+ /* failed to get profile */
+ if (filename == NULL) {
+ egg_warning ("failed to get filename from calibration");
+ goto out;
+ }
+
/* copy the ICC file to the proper location */
destination = gcm_utils_get_profile_destination (filename);
ret = gcm_utils_mkdir_and_copy (filename, destination, &error);
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index e03d699..7120241 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -49,6 +49,8 @@ gcm_utils_install_package (const gchar *package_name, GtkWindow *window)
guint32 xid = 0;
gchar **packages = NULL;
+ g_return_val_if_fail (package_name != NULL, FALSE);
+
#ifndef GCM_USE_PACKAGEKIT
egg_warning ("cannot install %s: this package was not compiled with --enable-packagekit", package_name);
return FALSE;
@@ -132,6 +134,8 @@ gcm_utils_ensure_sane_length (gchar *text, guint max_length)
guint i;
guint len;
+ g_return_if_fail (text != NULL);
+
/* get length */
len = strlen (text);
@@ -348,6 +352,8 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
GnomeRRScreen *rr_screen = NULL;
GConfClient *gconf_client = NULL;
+ g_return_val_if_fail (device != NULL, FALSE);
+
/* use gconf to decide to set LUT or set ATOMs */
gconf_client = gconf_client_get_default ();
@@ -573,6 +579,9 @@ gcm_utils_mkdir_and_copy (const gchar *source, const gchar *destination, GError
GFile *destfile;
GFile *destpath;
+ g_return_val_if_fail (source != NULL, FALSE);
+ g_return_val_if_fail (destination != NULL, FALSE);
+
/* setup paths */
sourcefile = g_file_new_for_path (source);
path = g_path_get_dirname (destination);
@@ -609,6 +618,8 @@ gcm_utils_get_profile_destination (const gchar *filename)
gchar *basename;
gchar *destination;
+ g_return_val_if_fail (filename != NULL, NULL);
+
/* get destination filename for this source file */
basename = g_path_get_basename (filename);
destination = g_build_filename (g_get_home_dir (), GCM_PROFILE_PATH, basename, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]