Avoid a NULL reference in msn_command_from_string. cpw.qulogic.msn

Sat, 21 Jun 2008 06:50:53 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sat, 21 Jun 2008 06:50:53 +0000
branch
cpw.qulogic.msn
changeset 23806
ef4e97200434
parent 23805
024a2801725c
child 23807
50511608138c
child 23835
890bf3200498

Avoid a NULL reference in msn_command_from_string.

References #5545.

libpurple/protocols/msn/command.c file | annotate | diff | comparison | revisions
--- 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
 	{

mercurial