changeset 23959:64a4069e504e

Do not allow setting empty shortcut for a custom smiley. Fixes <672525.16246.qm@web45411.mail.sp1.yahoo.com> reported by Jean La.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 26 Aug 2008 22:06:21 +0000
parents 08c29b5b0ee8
children 7071b52a0bf4
files pidgin/gtksmiley.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtksmiley.c	Sun Aug 24 06:35:01 2008 +0000
+++ b/pidgin/gtksmiley.c	Tue Aug 26 22:06:21 2008 +0000
@@ -224,6 +224,13 @@
 	PurpleSmiley *emoticon;
 
 	entry = gtk_entry_get_text(GTK_ENTRY(s->smile));
+	if (!entry || !*entry) {
+		purple_notify_error(s->parent, _("Custom Smiley"),
+				_("More Data needed"),
+				_("Please provide a shortcut to associate with the smiley."));
+		return;
+	}
+
 	emoticon = purple_smileys_find_by_shortcut(entry);
 	if (emoticon && emoticon != s->smiley) {
 		purple_notify_error(s->parent, _("Custom Smiley"),
@@ -346,7 +353,7 @@
 	window = gtk_dialog_new_with_buttons(smiley ? _("Edit Smiley") : _("Add Smiley"),
 			widget ? GTK_WINDOW(widget) : NULL,
 			GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,							 
+			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
 			NULL);
 	s->parent = window;