changeset 24350:e71c1fad229f

cmdproc->data should never be null. Log a warning message if it is (this is the same type of message logged by g_return_if_fail, right?)
author Mark Doliner <mark@kingant.net>
date Thu, 13 Nov 2008 09:19:17 +0000
parents f18f37a62971
children 9d2ae3639079
files libpurple/protocols/msn/slp.c
diffstat 1 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c	Thu Nov 13 09:00:45 2008 +0000
+++ b/libpurple/protocols/msn/slp.c	Thu Nov 13 09:19:17 2008 +0000
@@ -758,17 +758,20 @@
 
 	if (slplink->swboard == NULL)
 	{
-		/* We will need this in order to change its flags. */
-		slplink->swboard = (MsnSwitchBoard *)cmdproc->data;
-		/* If swboard is NULL, something has probably gone wrong earlier on
-		 * I didn't want to do this, but MSN 7 is somehow causing us to crash
-		 * here, I couldn't reproduce it to debug more, and people are
-		 * reporting bugs. Hopefully this doesn't cause more crashes. Stu.
-		 */
-		if (slplink->swboard != NULL)
+		if (cmdproc->data == NULL)
+			g_warning("msn_p2p_msg cmdproc->data was NULL\n");
+		else {
+			/*
+			 * We will swboard in order to change its flags.  If its
+			 * NULL, something has probably gone wrong earlier on.  I
+			 * didn't want to do this, but MSN 7 is somehow causing us
+			 * to crash here, I couldn't reproduce it to debug more,
+			 * and people are reporting bugs. Hopefully this doesn't
+			 * cause more crashes. Stu.
+			 */
+			slplink->swboard = (MsnSwitchBoard *)cmdproc->data;
 			slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink);
-		else
-			purple_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n");
+		}
 	}
 
 	msn_slplink_process_msg(slplink, msg);