From: wwp Date: Tue, 27 Dec 2016 17:02:55 +0000 (+0100) Subject: Fix enum boundaries we check in func_selection_changed (when X-Git-Tag: 3.15.0~162 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=30a1c0875f4ac72c1609c7beb0497d20ef789f64 Fix enum boundaries we check in func_selection_changed (when changing the internal function assigned to a toolbar item). Just a theoretical issue here apparently, or we would have had problems since ages. --- diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c index 24efd931f..b86835b58 100644 --- a/src/prefs_toolbar.c +++ b/src/prefs_toolbar.c @@ -861,15 +861,18 @@ static void func_selection_changed(GtkComboBox *action_combo, prefs_toolbar->item_func_combo)); if(text != NULL) { /* action */ - int action = -1; + int action; + action = toolbar_ret_val_from_descr(text); - if (action >= 0) + g_free(text); + if (action > -1) { + gint icon; + gtk_entry_set_text(GTK_ENTRY(prefs_toolbar->item_text_entry), toolbar_get_short_text(action)); - g_free(text); - if (action >= 0) { - StockPixmap stockp = toolbar_get_icon(action); - if (stockp >= 0) { + icon = toolbar_get_icon(action); + if (icon > -1) { + StockPixmap stockp = (StockPixmap)icon; g_free(prefs_toolbar->item_icon_file); prefs_toolbar->item_icon_file = g_strdup(stock_pixmap_get_name(stockp));