pidgin.vv: ebbb3b3e: Make Finch not crash if someone requests...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Tue Mar 31 03:51:03 EDT 2009


-----------------------------------------------------------------
Revision: ebbb3b3e9f4157b0c5c71662547a4aa6ba4c5fec
Ancestor: ffe0b5828b63bff452f490cb54b41bdf533d5df6
Author: maiku at soc.pidgin.im
Date: 2009-03-31T06:23:27
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/ebbb3b3e9f4157b0c5c71662547a4aa6ba4c5fec

Modified files:
        libpurple/media.c

ChangeLog: 

Make Finch not crash if someone requests a session with video with you.

-------------- next part --------------
============================================================
--- libpurple/media.c	5573f86d20d8ce1b62850edb02f1a3342138f192
+++ libpurple/media.c	7cf77a9403f513db88a0f6b41becd4aa734c4f59
@@ -1137,6 +1137,7 @@ purple_media_set_src(PurpleMedia *media,
 	GstPad *srcpad;
 
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
+	g_return_if_fail(GST_IS_ELEMENT(src));
 
 	session = purple_media_get_session(media, sess_id);
 
@@ -1679,6 +1680,7 @@ purple_media_add_stream(PurpleMedia *med
 		GList *codec_conf = NULL;
 		gchar *filename = NULL;
 		PurpleMediaSessionType session_type;
+		GstElement *src = NULL;
 
 		session = g_new0(PurpleMediaSession, 1);
 
@@ -1742,9 +1744,17 @@ purple_media_add_stream(PurpleMedia *med
 
 		session_type = purple_media_from_fs(media_type,
 				FS_DIRECTION_SEND);
-		purple_media_set_src(media, session->id,
-				purple_media_manager_get_element(
-				media->priv->manager, session_type));
+		src = purple_media_manager_get_element(
+				media->priv->manager, session_type);
+		if (!GST_IS_ELEMENT(src)) {
+			purple_debug_error("media",
+					"Error creating src for session %s\n",
+					session->id);
+			purple_media_end(media, session->id, NULL);
+			return FALSE;
+		}
+
+		purple_media_set_src(media, session->id, src);
 		gst_element_set_state(session->src, GST_STATE_PLAYING);
 
 		purple_media_manager_create_output_window(
@@ -1940,6 +1950,14 @@ purple_media_add_remote_candidates(Purpl
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 	stream = purple_media_get_stream(media, sess_id, name);
 
+	if (stream == NULL) {
+		purple_debug_error("media",
+				"purple_media_add_remote_candidates: "
+				"couldn't find stream %s %s.\n",
+				sess_id, name);
+		return;
+	}
+
 	stream->remote_candidates = g_list_concat(stream->remote_candidates,
 			purple_media_candidate_list_to_fs(remote_candidates));
 


More information about the Commits mailing list