[smuxi] Engine: fixed NRE thrown in Config.Load() when called by smuxi-server



commit 2aaea55e5a355d794525397e1944888f123e5e6e
Author: Mirco Bauer <meebey meebey net>
Date:   Mon Jun 22 20:17:09 2015 +0200

    Engine: fixed NRE thrown in Config.Load() when called by smuxi-server

 src/Engine/Engine.cs |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/Engine/Engine.cs b/src/Engine/Engine.cs
index 9549db2..27485ec 100644
--- a/src/Engine/Engine.cs
+++ b/src/Engine/Engine.cs
@@ -36,7 +36,16 @@ namespace Smuxi.Engine
         private static SessionManager   _SessionManager;
         private static ProtocolManagerFactory _ProtocolManagerFactory;
 
-        public static Version AssemblyVersion { get; private set; }
+        public static Version AssemblyVersion {
+            get {
+                var asm = Assembly.GetEntryAssembly();
+                if (asm == null) {
+                    asm = Assembly.GetAssembly(typeof(Engine));
+                }
+                var asm_name = asm.GetName(false);
+                return asm_name.Version;
+            }
+        }
 
         [Obsolete("Use AssemblyVersion or ProtocolVersion instead.")]
         public static Version Version {
@@ -95,7 +104,6 @@ namespace Smuxi.Engine
                 asm = Assembly.GetAssembly(typeof(Engine));
             }
             var asm_name = asm.GetName(false);
-            AssemblyVersion = asm_name.Version;
 
             var distVersion = Defines.DistVersion;
             if (!String.IsNullOrEmpty(distVersion)) {


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