[gnome-commander] Check for null before working with the argument variable



commit f80b72c627aa1fda2dd7cc0224818735fc2f131d
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Fri Aug 13 18:02:22 2021 +0200

    Check for null before working with the argument variable

 src/gnome-cmd-plain-path.cc | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/src/gnome-cmd-plain-path.cc b/src/gnome-cmd-plain-path.cc
index 58c66e58..3d9a70f6 100644
--- a/src/gnome-cmd-plain-path.cc
+++ b/src/gnome-cmd-plain-path.cc
@@ -54,6 +54,8 @@ GnomeCmdPath *GnomeCmdPlainPath::get_parent()
 
 GnomeCmdPath *GnomeCmdPlainPath::get_child(const gchar *child)
 {
+    g_return_val_if_fail(child != nullptr, nullptr);
+
     auto fullPath = *path == '/'
                         ? *child != '/' && strlen(path) > 1
                             ? g_strconcat(path, G_DIR_SEPARATOR_S, child, nullptr)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]