talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 9a7649aac85f5bf38f92236e5609de0c547a18e7
parent 24415eb70d1e92081ca8013fafb78679e4e2025f
Author: wwp <subscript@free.fr>
Date:   Sun, 12 Sep 2021 13:53:05 +0200

Fix CID 141151: coverity scared because we're testing of pointers that can
never be null (from gtk_entry_get_text()).

Diffstat:
Msrc/import.c | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/import.c b/src/import.c @@ -194,13 +194,17 @@ static void import_ok_cb(GtkWidget *widget, gpointer data) utf8mbox = gtk_entry_get_text(GTK_ENTRY(file_entry)); destdir = gtk_entry_get_text(GTK_ENTRY(dest_entry)); - if (utf8mbox && !*utf8mbox) { + cm_return_if_fail(utf8mbox); + cm_return_if_fail(destdir); + + if (!*utf8mbox) { alertpanel_error(_("Source mbox filename can't be left empty.")); gtk_widget_grab_focus(file_entry); return; } - if (destdir && !*destdir) { - if (alertpanel(_("Import mbox file"), _("Destination folder is not set.\nImport mbox file to the Inbox folder?"), + if (!*destdir) { + if (alertpanel(_("Import mbox file"), + _("Destination folder is not set.\nImport mbox file to the Inbox folder?"), _("_OK"), _("_Cancel"), NULL, ALERTFOCUS_FIRST) == G_ALERTALTERNATE) { gtk_widget_grab_focus(dest_entry); @@ -214,11 +218,10 @@ static void import_ok_cb(GtkWidget *widget, gpointer data) mbox = g_strdup(utf8mbox); } - if (!destdir || !*destdir) { + if (!*destdir) { dest = folder_find_item_from_path(INBOX_DIR); } else { - dest = folder_find_item_from_identifier - (destdir); + dest = folder_find_item_from_identifier(destdir); } if (!dest) {