From 07f20eb8fb34789ca0ff9d418545f87bec443b85 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 1 Sep 2008 04:00:00 +0000 Subject: Milan Crha ** Part of fix for bug #548827 (Check bounds of the string array before accessing elements, show more detailed error message if available). svn path=/trunk/; revision=36237 --- addressbook/gui/widgets/e-addressbook-view.c | 2 +- addressbook/gui/widgets/eab-gui-util.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'addressbook/gui/widgets') diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index ecae7ed8c3..142ed3550f 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1731,7 +1731,7 @@ static void delete_contacts_cb (EBook *book, EBookStatus status, gpointer clos break; default : /* Unknown error */ - e_error_run (NULL, "addressbook:generic-error", _("Failed to delete contact"), _("Other error"), NULL); + eab_error_dialog (_("Failed to delete contact"), status); break; } } diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 5f21e4da29..ba236da919 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -82,7 +82,12 @@ static const char *status_to_string[] = { void eab_error_dialog (const char *msg, EBookStatus status) { - const char *status_str = status_to_string [status]; + const char *status_str; + + if (status < 0 || status >= G_N_ELEMENTS (status_to_string)) + status_str = "Other error"; + else + status_str = status_to_string [status]; if (status_str) e_error_run (NULL, "addressbook:generic-error", msg, _(status_str), NULL); -- cgit v1.2.3