changeset 30247:a87764155fa5

Fix a crash in Finch < 2.7.0 with purple >= 2.7.0. The crash would happen if purple_sound_play_event is called for GOT_ATTENTION event. Finch itself doesn't do it, but a plugin might.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 05 Jul 2010 15:49:57 +0000
parents 3fdb8ef0fec7
children 9bd9ef37354f
files finch/gntsound.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntsound.c	Mon Jul 05 15:03:28 2010 +0000
+++ b/finch/gntsound.c	Mon Jul 05 15:49:57 2010 +0000
@@ -577,7 +577,8 @@
 	if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds)
 		return;
 
-	if (event >= PURPLE_NUM_SOUNDS) {
+	if (event >= PURPLE_NUM_SOUNDS ||
+			event >= G_N_ELEMENTS(sounds)) {
 		purple_debug_error("sound", "got request for unknown sound: %d\n", event);
 		return;
 	}