From: gu.martinm@gmail.com Date: Mon, 3 Mar 2014 00:21:43 +0000 (+0100) Subject: jsonrpc4net mono: avoid null return value X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=ba0926703028d5562786341ec2c6a20690e22d75;p=CSharpForFun%2F.git jsonrpc4net mono: avoid null return value --- diff --git a/Mono/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs b/Mono/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs index a2ad1dc..56469e0 100644 --- a/Mono/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs +++ b/Mono/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs @@ -97,8 +97,6 @@ namespace GumartinM.JsonRPC4Mono /// The 1st type parameter. private POSTResult ReadResponse(byte[] jsonBytes) { - POSTResult postResult = new POSTResult(); - string json = System.Text.Encoding.UTF8.GetString(jsonBytes); JObject jsonObjects = JObject.Parse(json); @@ -112,10 +110,10 @@ namespace GumartinM.JsonRPC4Mono if (jsonTokens.ContainsKey("result")) { - postResult = JsonConvert.DeserializeObject>(json, _jsonSettings); + return JsonConvert.DeserializeObject>(json, _jsonSettings); } - return postResult; + throw new JsonRpcClientException(0, "There is not neither error nor result in JSON response data.", jsonObjects); } ///