From d335acdc2e69f4f682f28dded96914240c1bdc1d Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Mon, 11 Nov 2013 21:33:54 +0100 Subject: [PATCH] THRIFT-2259 C# unexpected null logDelegate() pointer causes AV in TServer.serve() Patch: Jens Geyer --- lib/csharp/src/Server/TServer.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; } /** -- 2.17.1