From 15b98319b3d007e31a5b55a0bc0f21a4c1498e1d Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Thu, 2 Aug 2001 18:18:18 +0000 Subject: Don't do most of the work in this function if data->data is NULL. Fixes 2001-08-02 Christopher James Lahey * e-table-header-item.c (ethi_drag_data_received): Don't do most of the work in this function if data->data is NULL. Fixes Ximian bug #6041. svn path=/trunk/; revision=11587 --- widgets/table/e-table-header-item.c | 48 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index c4ad630a9e..acaa1c1510 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -608,29 +608,35 @@ ethi_drag_data_received (GtkWidget *canvas, ETableHeaderItem *ethi) { int found = FALSE; - int count = e_table_header_count(ethi->eth); - int column = atoi(data->data); - int drop_col = ethi->drop_col; + int count; + int column; + int drop_col; int i; - ethi->drop_col = -1; - if (column < 0) - return; - for (i = 0; i < count; i++) { - ETableCol *ecol = e_table_header_get_column (ethi->eth, i); - if (ecol->col_idx == column) { - e_table_header_move(ethi->eth, i, drop_col); - found = TRUE; - break; - } - } - if (!found) { - count = e_table_header_count(ethi->full_header); - for (i = 0; i < count; i++) { - ETableCol *ecol = e_table_header_get_column (ethi->full_header, i); - if (ecol->col_idx == column) { - e_table_header_add_column (ethi->eth, ecol, drop_col); - break; + if (data->data) { + count = e_table_header_count(ethi->eth); + column = atoi(data->data); + drop_col = ethi->drop_col; + ethi->drop_col = -1; + + if (column >= 0) { + for (i = 0; i < count; i++) { + ETableCol *ecol = e_table_header_get_column (ethi->eth, i); + if (ecol->col_idx == column) { + e_table_header_move(ethi->eth, i, drop_col); + found = TRUE; + break; + } + } + if (!found) { + count = e_table_header_count(ethi->full_header); + for (i = 0; i < count; i++) { + ETableCol *ecol = e_table_header_get_column (ethi->full_header, i); + if (ecol->col_idx == column) { + e_table_header_add_column (ethi->eth, ecol, drop_col); + break; + } + } } } } -- cgit