changeset 17384:320b0b450c7b

msim_msg_get_integer() - if could not find element, return 0.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Thu, 14 Jun 2007 08:21:36 +0000
parents f057837085b0
children 22d3499df3f6
files libpurple/protocols/myspace/message.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/message.c	Thu Jun 14 08:18:59 2007 +0000
+++ b/libpurple/protocols/myspace/message.c	Thu Jun 14 08:21:36 2007 +0000
@@ -824,7 +824,7 @@
  *
  * @param name Name of element.
  *
- * @return guint Numeric representation of data, or 0 if could not be converted.
+ * @return guint Numeric representation of data, or 0 if could not be converted / not found.
  *
  * Useful to obtain an element's data if you know it should be an integer,
  * even if it is not stored as an MSIM_TYPE_INTEGER. MSIM_TYPE_STRING will
@@ -836,6 +836,9 @@
 
 	elem = msim_msg_get(msg, name);
 
+	if (!elem)
+		return 0;
+
 	switch (elem->type)
 	{
 		case MSIM_TYPE_INTEGER: