THRIFT-2259 C# unexpected null logDelegate() pointer causes AV in TServer.serve()

Patch: Jens Geyer
diff --git a/lib/csharp/src/Server/TServer.cs b/lib/csharp/src/Server/TServer.cs
index 7bf2747..19f11e4 100644
--- a/lib/csharp/src/Server/TServer.cs
+++ b/lib/csharp/src/Server/TServer.cs
@@ -59,8 +59,14 @@
 		 * Output Protocol Factory
 		 */
 		protected TProtocolFactory outputProtocolFactory;
-		public delegate void LogDelegate(string str);
-		protected LogDelegate logDelegate;
+
+        public delegate void LogDelegate(string str);

+        private LogDelegate _logDelegate;

+        protected LogDelegate logDelegate

+        {

+            get { return _logDelegate; }

+            set { _logDelegate = (value != null) ? value : DefaultLogDelegate; } 
+        }
 
 		/**
 		 * Default constructors.
@@ -120,7 +126,7 @@
 			this.outputTransportFactory = outputTransportFactory;
 			this.inputProtocolFactory = inputProtocolFactory;
 			this.outputProtocolFactory = outputProtocolFactory;
-			this.logDelegate = logDelegate;
+			this.logDelegate = (logDelegate != null) ? logDelegate : DefaultLogDelegate;
 		}
 
 		/**