Make sure our prefix length is > 0 before lopping off the last

character.  Fixes bug 4797.

svn path=/trunk/; revision=32987
This commit is contained in:
Gerald Combs 2010-05-27 00:49:01 +00:00
parent 391b5127d6
commit b3a83551a3
1 changed files with 10 additions and 6 deletions

View File

@ -382,7 +382,7 @@ filter_string_te_key_pressed_cb(GtkWidget *filter_te, GdkEventKey *event)
}
return FALSE;
}
/* Let prefix points to the first char that is not aphanumeric,'.', '_' or '-',
* start from the end of filter_te_str.
**/
@ -772,16 +772,20 @@ filter_autocomplete_handle_backspace(GtkWidget *filter_te, GtkWidget *list, GtkW
size_t prefix_len;
gboolean protocols_only = FALSE;
/* Delete the last character in the prefix string */
prefix_len = strlen(prefix)-1;
prefix[prefix_len] = '\0';
prefix_len = strlen(prefix);
if (prefix_len == 0) {
if (prefix_len < 1) {
/* Remove the popup window for protocols */
gtk_widget_destroy(popup_win);
g_object_set_data(G_OBJECT(main_win), E_FILT_AUTOCOMP_PTR_KEY, NULL);
return;
} else if(strchr(prefix, '.') == NULL) {
}
/* Delete the last character in the prefix string */
prefix_len--;
prefix[prefix_len] = '\0';
if(strchr(prefix, '.') == NULL) {
protocols_only = TRUE;
}