[gnome-commander] Check for NULL pointer before pointer is actually used
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Check for NULL pointer before pointer is actually used
- Date: Fri, 7 Oct 2016 20:23:24 +0000 (UTC)
commit 008a2ef446bf0f81d0af78aa68c1b6429c40b9ed
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sun Oct 2 20:07:13 2016 +0200
Check for NULL pointer before pointer is actually used
src/dialogs/gnome-cmd-advrename-dialog.cc | 3 ++-
src/dialogs/gnome-cmd-prepare-xfer-dialog.cc | 13 +++++++------
src/dialogs/gnome-cmd-search-dialog.cc | 3 ++-
3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-advrename-dialog.cc b/src/dialogs/gnome-cmd-advrename-dialog.cc
index f41b781..763fa4f 100644
--- a/src/dialogs/gnome-cmd-advrename-dialog.cc
+++ b/src/dialogs/gnome-cmd-advrename-dialog.cc
@@ -123,10 +123,11 @@ inline GtkWidget *GnomeCmdAdvrenameDialog::Private::create_placeholder_menu(Gnom
{
guint items_size = cfg->profiles.empty() ? 1 : cfg->profiles.size()+3;
GtkItemFactoryEntry *items = g_try_new0 (GtkItemFactoryEntry, items_size);
- GtkItemFactoryEntry *i = items;
g_return_val_if_fail (items!=NULL, NULL);
+ GtkItemFactoryEntry *i = items;
+
i->path = g_strdup (_("/_Save Profile As..."));
i->callback = (GtkItemFactoryCallback) manage_profiles;
i->callback_action = TRUE;
diff --git a/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc b/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc
index f97bf1b..015fd27 100644
--- a/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc
+++ b/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc
@@ -49,17 +49,18 @@ static void on_ok (GtkButton *button, GnomeCmdPrepareXferDialog *dialog)
{
GnomeCmdCon *con = gnome_cmd_dir_get_connection (dialog->default_dest_dir);
gchar *user_path = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->dest_dir_entry))));
- gint user_path_len = strlen (user_path);
-
- gchar *dest_path = user_path;
+ gchar *dest_path = NULL;
gchar *dest_fn = NULL;
- GnomeCmdDir *dest_dir;
-
- // Make whatever the user entered into a valid path if possible
+ gint user_path_len;
if (!user_path)
goto bailout;
+ user_path_len = strlen (user_path);
+ dest_path = user_path;
+ GnomeCmdDir *dest_dir;
+
+ // Make whatever the user entered into a valid path if possible
if (user_path_len > 2 && user_path[user_path_len-1] == '/')
user_path[user_path_len-1] = '\0';
diff --git a/src/dialogs/gnome-cmd-search-dialog.cc b/src/dialogs/gnome-cmd-search-dialog.cc
index 75e6eb8..f3a8305 100644
--- a/src/dialogs/gnome-cmd-search-dialog.cc
+++ b/src/dialogs/gnome-cmd-search-dialog.cc
@@ -173,10 +173,11 @@ inline GtkWidget *GnomeCmdSearchDialog::Private::create_placeholder_menu(GnomeCm
{
guint items_size = cfg.profiles.empty() ? 1 : cfg.profiles.size()+3;
GtkItemFactoryEntry *items = g_try_new0 (GtkItemFactoryEntry, items_size);
- GtkItemFactoryEntry *i = items;
g_return_val_if_fail (items!=NULL, NULL);
+ GtkItemFactoryEntry *i = items;
+
i->path = g_strdup (_("/_Save Profile As..."));
i->callback = (GtkItemFactoryCallback) manage_profiles;
i->callback_action = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]