# HG changeset patch # User Richard Laager # Date 1146515485 0 # Node ID fa55fb41ed0d8c38d50af6e31d6ec714dc47b350 # Parent f4af8af0b6437777ab04457f394b68c096cebec4 [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. diff -r f4af8af0b643 -r fa55fb41ed0d src/prefs.c --- 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: