[balsa] balsa-mime-widget-callbacks: Handle error better
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] balsa-mime-widget-callbacks: Handle error better
- Date: Mon, 17 Jan 2022 23:54:42 +0000 (UTC)
commit b4904a46ba827c2c07026e916187464a54be2b9f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Mon Jan 17 18:52:04 2022 -0500
balsa-mime-widget-callbacks: Handle error better
If unlink fails, clear the GError and do not continue to save the
attachment.
src/balsa-mime-widget-callbacks.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/balsa-mime-widget-callbacks.c b/src/balsa-mime-widget-callbacks.c
index 895e5a844..f4803475b 100644
--- a/src/balsa-mime-widget-callbacks.c
+++ b/src/balsa-mime-widget-callbacks.c
@@ -70,7 +70,7 @@ balsa_mime_widget_ctx_menu_save(GtkWidget * parent_widget,
GtkWidget *save_dialog;
gchar *file_uri;
LibbalsaVfs *save_file;
- gboolean do_save;
+ gboolean do_save = TRUE;
GError *err = NULL;
g_return_if_fail(mime_body != NULL);
@@ -145,13 +145,16 @@ balsa_mime_widget_ctx_menu_save(GtkWidget * parent_widget,
do_save =
(gtk_dialog_run(GTK_DIALOG(confirm)) == GTK_RESPONSE_YES);
gtk_widget_destroy(confirm);
- if (do_save)
- if (libbalsa_vfs_file_unlink(save_file, &err) != 0)
+ if (do_save) {
+ if (libbalsa_vfs_file_unlink(save_file, &err) != 0) {
balsa_information(LIBBALSA_INFORMATION_ERROR,
_("Unlink %s: %s"),
file_uri, err ? err->message : "Unknown error");
- } else
- do_save = TRUE;
+ g_clear_error(&err);
+ do_save = FALSE;
+ }
+ }
+ }
/* save the file */
if (do_save) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]