[gnc-budget-view] total_nodes may be exhausted. assign NULL.

the refactor in 8cef481e1 introduced a crasher -- in the line

totals_view_col = gtk_tree_view_get_column (priv->totals_tree_view, j);

j would occasionally exceed the number of columns available in the
GtkTreeView and the function would return NULL. This change restores
this behaviour.

I found that switching preference Account -> Default currency radio
buttons would trigger this crasher. To illustrate, add the following
tracer immediately after assigning totals_view_col.

PWARN ("tree_view_col=%p, totals_view_col=%p", tree_view_col, totals_view_col)
pull/1286/head
Christopher Lam 4 years ago
parent 545830f3b8
commit 8fa197eebf

@ -884,7 +884,7 @@ gbv_treeview_resized_cb (GtkWidget *widget, GtkAllocation *allocation,
if ((g_strcmp0 (name, "description") == 0) && (!priv->show_account_desc))
total_node = g_list_next (total_node);
if (gtk_tree_view_column_get_visible (tree_view_col))
if (gtk_tree_view_column_get_visible (tree_view_col) && total_node != NULL)
{
gint col_width = gtk_tree_view_column_get_width (tree_view_col);
GtkTreeViewColumn *totals_view_col = total_node->data;

Loading…
Cancel
Save