libpurple/smiley-list.c

changeset 35746
e4a656378516
parent 35738
030ce6840163
child 35747
25085b485441
--- a/libpurple/smiley-list.c	Fri Apr 04 12:34:47 2014 +0200
+++ b/libpurple/smiley-list.c	Fri Apr 04 14:04:45 2014 +0200
@@ -128,6 +128,11 @@
 		priv->smileys_end);
 
 	smiley_path = purple_smiley_get_path(smiley);
+
+	/* TODO: add to the table, when smiley sets the path */
+	if (!smiley_path)
+		return TRUE;
+
 	if (g_hash_table_lookup(priv->path_map, smiley_path) == NULL) {
 		g_hash_table_insert(priv->path_map,
 			g_strdup(smiley_path), smiley);
@@ -160,7 +165,8 @@
 	path = purple_smiley_get_path(smiley);
 
 	g_hash_table_remove(priv->shortcut_map, shortcut);
-	g_hash_table_remove(priv->path_map, path);
+	if (path)
+		g_hash_table_remove(priv->path_map, path);
 
 	if (purple_smiley_parse_escape())
 		shortcut = tmp = g_markup_escape_text(shortcut, -1);
@@ -171,7 +177,7 @@
 	_list_remove_link2(&priv->smileys, &priv->smileys_end, list_elem);
 
 	/* re-add entry to path_map if smiley was not unique */
-	for (it = priv->smileys; it; it = g_list_next(it)) {
+	for (it = priv->smileys; it && path; it = g_list_next(it)) {
 		PurpleSmiley *smiley = it->data;
 
 		if (g_strcmp0(purple_smiley_get_path(smiley), path) == 0) {

mercurial