[evolution] Bug #637641 - Crash on audio alarms with invalid file URI set



commit cc4dd64854e652e4f6c8552069977088c87268bb
Author: Milan Crha <mcrha redhat com>
Date:   Wed Mar 9 08:56:56 2011 +0100

    Bug #637641 - Crash on audio alarms with invalid file URI set

 calendar/gui/alarm-notify/alarm-queue.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 3f8cccb..4f32335 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -1690,25 +1690,28 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
 
 	if (attach && icalattach_get_is_url (attach)) {
 		const gchar *url;
-		gchar *filename;
-		GError *error = NULL;
 
 		url = icalattach_get_url (attach);
-		filename = g_filename_from_uri (url, NULL, &error);
+		if (url && *url) {
+			gchar *filename;
+			GError *error = NULL;
 
-		if (error != NULL) {
-			g_warning ("%s: %s", G_STRFUNC, error->message);
-			g_error_free (error);
-		} else if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
-			flag = 1;
+			filename = g_filename_from_uri (url, NULL, &error);
+
+			if (error != NULL) {
+				g_warning ("%s: %s", G_STRFUNC, error->message);
+				g_error_free (error);
+			} else if (filename && g_file_test (filename, G_FILE_TEST_EXISTS)) {
 #ifdef HAVE_CANBERRA
-			ca_context_play (
-				ca_gtk_context_get (), 0,
-				CA_PROP_MEDIA_FILENAME, filename, NULL);
+				flag = 1;
+				ca_context_play (
+					ca_gtk_context_get (), 0,
+					CA_PROP_MEDIA_FILENAME, filename, NULL);
 #endif
-		}
+			}
 
-		g_free (filename);
+			g_free (filename);
+		}
 	}
 
 	if (!flag)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]