changeset 13710:848c9685ecc7

[gaim-migrate @ 16114] CID 153 Same idea as CID 154: Do the sanity checks directly, in case g_return_if_fail()s are being compiled out. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 01 May 2006 20:31:25 +0000
parents ff25f6d2b484
children 967ef719cb62
files src/prefs.c
diffstat 1 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/prefs.c	Mon May 01 20:27:49 2006 +0000
+++ b/src/prefs.c	Mon May 01 20:31:25 2006 +0000
@@ -915,17 +915,33 @@
 	struct gaim_pref *oldpref, *newpref;
 
 	oldpref = find_pref(oldname);
-	newpref = find_pref(newname);
 
 	/* it's already been renamed, call off the dogs */
 	if(!oldpref)
 		return;
 
-	gaim_debug_info("prefs", "Renaming %s to %s\n", oldname, newname);
+	if (oldpref->first_child != NULL) /* can't rename parents */
+	{
+		gaim_debug_error("prefs", "Unable to rename %s to %s: can't rename parents\n", oldname, newname);
+		return;
+	}
+
+
+	newpref = find_pref(newname);
 
-	g_return_if_fail(newpref != NULL); /* the new one needs to be created first */
-	g_return_if_fail(oldpref->type == newpref->type);
-	g_return_if_fail(oldpref->first_child == NULL); /* can't rename parents */
+	if (newpref == NULL)
+	{
+		gaim_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname);
+		return;
+	}
+
+	if (oldpref->type != newpref->type)
+	{
+		gaim_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname);
+		return;
+	}
+
+	gaim_debug_info("prefs", "Renaming %s to %s\n", oldname, newname);
 
 	switch(oldpref->type) {
 		case GAIM_PREF_NONE: