Bug 798133 - Gnucash crash when any custom action is entered

1. Protect strlen call in gnucash_sheet_modify_current_cell to
prevent it from crashing.

2. Handle NULL selection in gnc_item_list_key_event when key is
GDK_KEY_Return so that new string in combo control is handled
correctly.
pull/977/head
John Ralls 5 years ago
parent f7f35faefe
commit 40e005d963

@ -352,6 +352,8 @@ gnc_item_list_key_event (GtkWidget* widget, GdkEventKey* event, gpointer data)
{
case GDK_KEY_Return:
string = gnc_item_list_get_selection (item_list);
if (!string) // Nothing selected, might be new value
break; // Let the sheet deal with it.
g_signal_emit (G_OBJECT (item_list),
gnc_item_list_signals[ACTIVATE_ITEM],
0,

@ -888,7 +888,7 @@ gnucash_sheet_modify_current_cell (GnucashSheet *sheet, const gchar *new_text)
GtkEditable *editable;
Table *table = sheet->table;
VirtualLocation virt_loc;
int new_text_len;
int new_text_len = 0;
const char *retval;
int cursor_position, start_sel, end_sel;
@ -905,7 +905,8 @@ gnucash_sheet_modify_current_cell (GnucashSheet *sheet, const gchar *new_text)
cursor_position = gtk_editable_get_position (editable);
gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel);
new_text_len = strlen (new_text);
if (new_text)
new_text_len = strlen (new_text);
retval = gnc_table_modify_update (table, virt_loc,
new_text, new_text_len,

Loading…
Cancel
Save