[gnome-commander] Check if gFile is not null



commit 5dc92c55dee7e6e7f73290db575c2edb9ba7dbcf
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Wed Oct 6 21:21:05 2021 +0200

    Check if gFile is not null

 src/gnome-cmd-con.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index bd7aad3c..d3d34862 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -489,9 +489,10 @@ gboolean gnome_cmd_con_get_path_target_type (GnomeCmdCon *con, const gchar *path
     GnomeCmdPath *path = gnome_cmd_con_create_path (con, path_str);
     auto gFile = gnome_cmd_con_create_gfile(con, path);
 
-    if (!g_file_query_exists(gFile, nullptr))
+    if (!gFile || !g_file_query_exists(gFile, nullptr))
     {
-        g_object_unref(gFile);
+        if (!gFile)
+            g_object_unref(gFile);
         *gFileType = G_FILE_TYPE_UNKNOWN;
         delete path;
         return false;


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