changeset 12434:1811afd29b57

[gaim-migrate @ 14741] OSCAR, at least, is guilty of setting status messages on statuses which do not accept a message with some regularity. I'm betting other protocols have similar errors. This causes such errors to be logged as an error to the debug window, so that they can be tracked down and fixed. In general, we seem to be abusing g_return_if_fail -- it's intended to be an *assertion*, not a shortcut for normal return conditions. I think it complains (or can complain) to the debug window itself ... maybe we need to make it louder. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Fri, 09 Dec 2005 05:07:10 +0000
parents 74d5a423433c
children 8f98014a4e7d
files src/status.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/status.c	Fri Dec 09 05:05:06 2005 +0000
+++ b/src/status.c	Fri Dec 09 05:07:10 2005 +0000
@@ -865,7 +865,18 @@
 
 	/* Make sure this attribute exists and is the correct type. */
 	attr_value = gaim_status_get_attr_value(status, id);
-	g_return_if_fail(attr_value != NULL);
+	/* This used to be g_return_if_fail, but it's failing a LOT, so
+	 * let's generate a log error for now. */
+	/* g_return_if_fail(attr_value != NULL); */
+	if (attr_value == NULL) {
+		gaim_debug_error("status",
+				 "Attempted to set status attribute '%s' for "
+				 "status '%s', which is not legal.  Fix "
+                                 "this!\n", id,
+				 gaim_status_type_get_name(gaim_status_get_type(status)));
+		return;
+				 				 
+	}
 	g_return_if_fail(gaim_value_get_type(attr_value) == GAIM_TYPE_STRING);
 
 	gaim_value_set_string(attr_value, value);