From: Jens Geyer Date: Mon, 11 Nov 2013 20:33:54 +0000 (+0100) Subject: THRIFT-2259 C# unexpected null logDelegate() pointer causes AV in TServer.serve() X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=d335acdc2e69f4f682f28dded96914240c1bdc1d;p=common%2Fthrift.git 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 7bf27472..19f11e4a 100644 --- a/lib/csharp/src/Server/TServer.cs +++ b/lib/csharp/src/Server/TServer.cs @@ -59,8 +59,14 @@ namespace Thrift.Server * 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 @@ namespace Thrift.Server this.outputTransportFactory = outputTransportFactory; this.inputProtocolFactory = inputProtocolFactory; this.outputProtocolFactory = outputProtocolFactory; - this.logDelegate = logDelegate; + this.logDelegate = (logDelegate != null) ? logDelegate : DefaultLogDelegate; } /**