[gnome-commander] Additional nullptr checks
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Additional nullptr checks
- Date: Mon, 29 Nov 2021 07:03:36 +0000 (UTC)
commit 753a92e9a763814a8f8f6d6470de4c0aa85b1106
Author: Uwe Scholz <u scholz83 gmx de>
Date: Mon Nov 29 08:03:21 2021 +0100
Additional nullptr checks
src/gnome-cmd-file.cc | 4 ++++
src/gnome-cmd-user-actions.cc | 13 +++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index f9ea46b7..f94cba8d 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -522,6 +522,10 @@ gchar *GnomeCmdFile::get_real_path()
gchar *GnomeCmdFile::get_quoted_real_path()
{
gchar *path = get_real_path();
+
+ if (!path)
+ return nullptr;
+
gchar *ret = quote_if_needed (path);
g_free (path);
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 0b525b62..954d4a4a 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -628,8 +628,12 @@ static void get_file_list (string &s, GList *sfl, F f)
vector<string> a;
for (GList *i = sfl; i; i = i->next)
- a.push_back ((*f) (GNOME_CMD_FILE (i->data)));
+ {
+ auto value = (*f) (GNOME_CMD_FILE (i->data));
+ if (value)
+ a.push_back (value);
+ }
join (s, a.begin(), a.end());
}
@@ -640,7 +644,12 @@ inline void get_file_list (string &s, GList *sfl, F f, T t)
vector<string> a;
for (GList *i = sfl; i; i = i->next)
- a.push_back ((*f) (GNOME_CMD_FILE (i->data), t));
+ {
+ auto value = (*f) (GNOME_CMD_FILE (i->data), t);
+
+ if (value)
+ a.push_back (value);
+ }
join (s, a.begin(), a.end());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]