[longomatch] Fix segfault when CERBERO_PREFIX is not defined in an uninstalled environment.



commit c4174d547b5d246e91b640e650c1ce700021725d
Author: Xavi Artigas <xartigas fluendo com>
Date:   Mon Apr 27 10:37:14 2015 +0200

    Fix segfault when CERBERO_PREFIX is not defined in an uninstalled environment.

 LongoMatch.Services/CoreServices.cs |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Services/CoreServices.cs b/LongoMatch.Services/CoreServices.cs
index 61739d5..a81a988 100644
--- a/LongoMatch.Services/CoreServices.cs
+++ b/LongoMatch.Services/CoreServices.cs
@@ -85,9 +85,13 @@ namespace LongoMatch.Services
                        string localesDir = Config.RelativeToPrefix ("share/locale");
 
                        if (!Directory.Exists (localesDir)) {
-                               localesDir = Path.Combine (
-                                       Environment.GetEnvironmentVariable ("CERBERO_PREFIX"),
-                                       "share", "locale");
+                               var cerbero_prefix = Environment.GetEnvironmentVariable ("CERBERO_PREFIX");
+                               if (cerbero_prefix != null) {
+                                       localesDir = Path.Combine (cerbero_prefix, "share", "locale");
+                               } else {
+                                       Log.ErrorFormat ("'{0}' does not exist. This looks like an 
uninstalled execution." +
+                                               "Define CERBERO_PREFIX.", localesDir);
+                               }
                        }
                        /* Init internationalization support */
                        Catalog.Init (Constants.SOFTWARE_NAME.ToLower (), localesDir);


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