[rhythmbox] audiocd: don't try to set the year when no value is provided



commit 532aeb52d2051ed6c3dcc100a3068e0c17653ce5
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Feb 21 16:20:15 2010 +1000

    audiocd: don't try to set the year when no value is provided

 plugins/audiocd/rb-audiocd-source.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index d6fc8c4..a967e6c 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -1195,11 +1195,17 @@ update_genre_cb (GtkWidget *widget, GdkEventFocus *event, RBAudioCdSource *sourc
 static gboolean
 update_year_cb (GtkWidget *widget, GdkEventFocus *event, RBAudioCdSource *source)
 {
+	const char *text;
 	int year;
 	GDate date;
 	GValue v = {0, };
 
-	year = strtol (gtk_entry_get_text (GTK_ENTRY (widget)), NULL, 10);
+	text = gtk_entry_get_text (GTK_ENTRY (widget));
+	if (text[0] == '\0') {
+		return FALSE;
+	}
+
+	year = strtol (text, NULL, 10);
 	g_date_clear (&date, 1);
 	g_date_set_dmy (&date, 1, 1, year);
 



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