# HG changeset patch # User Elliott Sales de Andrade # Date 1229310020 0 # Node ID fbd1a82247bac1a5cb88500fe96e9dce69cf0827 # Parent 7b6037f09baf4e94edfeb863e63a2249f904c3f7 For processing mobile OIM's, fix a crash when searching through each part of the message. There could be no content-type/body if it was unparseable. Also, skip the first part which is "This is a multipart message... " text. diff -r 7b6037f09baf -r fbd1a82247ba libpurple/protocols/msn/oim.c --- a/libpurple/protocols/msn/oim.c Mon Dec 15 02:22:01 2008 +0000 +++ b/libpurple/protocols/msn/oim.c Mon Dec 15 03:00:20 2008 +0000 @@ -630,13 +630,16 @@ msn_message_get_attr(message, "boundary")); tokens = g_strsplit(message->body, boundary, 0); - for (part = tokens; *part != NULL; part++) { + /* tokens+1 to skip the "This is a multipart message..." text */ + for (part = tokens+1; *part != NULL; part++) { MsnMessage *multipart; + const char *type; multipart = msn_message_new(MSN_MSG_UNKNOWN); msn_message_parse_payload(multipart, *part, strlen(*part), MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); - if (!strcmp(msn_message_get_content_type(multipart), "text/plain")) { + type = msn_message_get_content_type(multipart); + if (type && !strcmp(type, "text/plain")) { decode_msg = (char *)purple_base64_decode(multipart->body, &body_len); msn_message_destroy(multipart); break;