[gnome-builder] runtime: handle NULL install-directory



commit 483cf0c81909463b5e143adfb0a688919c279247
Author: Christian Hergert <chergert redhat com>
Date:   Thu Mar 30 00:16:48 2017 -0600

    runtime: handle NULL install-directory
    
    The install-directory can return NULL, so we need to check for that first.

 libide/runtimes/ide-runtime.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/libide/runtimes/ide-runtime.c b/libide/runtimes/ide-runtime.c
index 516068a..7cdcbf8 100644
--- a/libide/runtimes/ide-runtime.c
+++ b/libide/runtimes/ide-runtime.c
@@ -199,22 +199,28 @@ ide_runtime_real_create_runner (IdeRuntime     *self,
       name = tmp;
     }
 
-  /* GSettings requires an env var for non-standard dirs */
-  parentdir = g_file_get_parent (installdir);
-  if (parentdir)
+  if (installdir != NULL)
     {
-      parentpath = g_file_get_path (parentdir);
-      schemadir = g_build_filename (parentpath, "share",
-                                "glib-2.0", "schemas", NULL);
+      /* GSettings requires an env var for non-standard dirs */
+      parentdir = g_file_get_parent (installdir);
+      if (parentdir)
+        {
+          parentpath = g_file_get_path (parentdir);
+          schemadir = g_build_filename (parentpath, "share",
+                                    "glib-2.0", "schemas", NULL);
 
-      env = ide_runner_get_environment (runner);
-      ide_environment_setenv (env, "GSETTINGS_SCHEMA_DIR", schemadir);
-    }
+          env = ide_runner_get_environment (runner);
+          ide_environment_setenv (env, "GSETTINGS_SCHEMA_DIR", schemadir);
+        }
 
-  bin = g_file_get_child (installdir, name);
-  binpath = g_file_get_path (bin);
+      bin = g_file_get_child (installdir, name);
+      binpath = g_file_get_path (bin);
+
+      ide_runner_append_argv (runner, binpath);
+    }
+  else
+    ide_runner_append_argv (runner, name);
 
-  ide_runner_append_argv (runner, binpath);
 
   return runner;
 }


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