/pidgin/main: bb50003b96d0: Fix a crash

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu May 22 13:37:35 EDT 2014


Changeset: bb50003b96d066f4cae0ab34f54b3a4fa6decf3d
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-05-22 17:10 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/bb50003b96d0

Description:

Fix a crash

diffstat:

 libpurple/conversations.c |  2 +-
 libpurple/sound.c         |  2 ++
 pidgin/gtksound.c         |  2 ++
 3 files changed, 5 insertions(+), 1 deletions(-)

diffs (36 lines):

diff --git a/libpurple/conversations.c b/libpurple/conversations.c
--- a/libpurple/conversations.c
+++ b/libpurple/conversations.c
@@ -309,7 +309,7 @@ purple_conversations_init(void)
 		2, PURPLE_TYPE_ACCOUNT, PURPLE_TYPE_MESSAGE);
 
 	purple_signal_register(handle, "sent-im-msg",
-		purple_marshal_VOID__POINTER_POINTER_POINTER, G_TYPE_NONE,
+		purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE,
 		2, PURPLE_TYPE_ACCOUNT, PURPLE_TYPE_MESSAGE);
 
 	purple_signal_register(handle, "receiving-im-msg",
diff --git a/libpurple/sound.c b/libpurple/sound.c
--- a/libpurple/sound.c
+++ b/libpurple/sound.c
@@ -81,6 +81,8 @@ purple_sound_play_event(PurpleSoundEvent
 	if (!purple_sound_play_required(account))
 		return;
 
+	g_return_if_fail(event < PURPLE_NUM_SOUNDS);
+
 	if (time(NULL) - last_played[event] < 2)
 		return;
 	last_played[event] = time(NULL);
diff --git a/pidgin/gtksound.c b/pidgin/gtksound.c
--- a/pidgin/gtksound.c
+++ b/pidgin/gtksound.c
@@ -110,6 +110,8 @@ chat_nick_matches_name(PurpleChatConvers
 static void
 play_conv_event(PurpleConversation *conv, PurpleSoundEventID event)
 {
+	g_return_if_fail(event < PURPLE_NUM_SOUNDS);
+
 	/* If we should not play the sound for some reason, then exit early */
 	if (conv != NULL && PIDGIN_IS_PIDGIN_CONVERSATION(conv))
 	{



More information about the Commits mailing list