changeset 23494:c1cba867b3da

Avoid a NULL reference in msn_command_from_string. References #5545.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 21 Jun 2008 06:50:53 +0000
parents c5891c8d0c28
children 0fc1d2df836e 9fa6ce44149f
files libpurple/protocols/msn/command.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/command.c	Sat Jun 21 06:15:38 2008 +0000
+++ b/libpurple/protocols/msn/command.c	Sat Jun 21 06:50:53 2008 +0000
@@ -107,15 +107,17 @@
 
 	if (cmd->params != NULL)
 	{
-		char *param;
 		int c;
 
 		for (c = 0; cmd->params[c]; c++);
 		cmd->param_count = c;
 
-		param = cmd->params[0];
-
-		cmd->trId = is_num(param) ? atoi(param) : 0;
+		if (cmd->param_count) {
+			char *param = cmd->params[0];
+			cmd->trId = is_num(param) ? atoi(param) : 0;
+		} else {
+			cmd->trId = 0;
+		}
 	}
 	else
 	{