From 6d8a1029bf7b6fee68d2f62b9b70b6474da83fd8 Mon Sep 17 00:00:00 2001 From: Monsta Date: Mon, 5 Jan 2015 18:54:36 +0300 Subject: sendto: safer access to list element's data g_list_nth_data just returns NULL if either list or element is NULL Closes https://github.com/mate-desktop/caja-extensions/pull/11 --- sendto/caja-sendto-command.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sendto') diff --git a/sendto/caja-sendto-command.c b/sendto/caja-sendto-command.c index 6e30885..ede4774 100644 --- a/sendto/caja-sendto-command.c +++ b/sendto/caja-sendto-command.c @@ -375,17 +375,17 @@ toggle_pack_check (GtkWidget *widget, NS_ui *ui) static void option_changed (GtkComboBox *cb, NS_ui *ui) { - GList *aux; + GtkWidget *w; NstPlugin *p; gboolean supports_dirs = FALSE; - aux = g_list_nth (ui->contact_widgets, option); + w = g_list_nth_data (ui->contact_widgets, option); option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb)); - gtk_widget_hide ((GtkWidget *) aux->data); - aux = g_list_nth (ui->contact_widgets, option); - gtk_widget_show ((GtkWidget *) aux->data); + gtk_widget_hide (w); + w = g_list_nth_data (ui->contact_widgets, option); + gtk_widget_show (w); - gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), aux->data); + gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w); p = (NstPlugin *) g_list_nth_data (plugin_list, option); supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES); -- cgit v1.2.1