From c80a41baed8623a130a25c396840b76ce23b4d7f Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Tue, 28 Mar 2023 16:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=A9=BA=E5=AF=B9=E8=B1=A1=EF=BC=8C=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/Tnb.Systems/System/DataInterfaceService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/system/Tnb.Systems/System/DataInterfaceService.cs b/system/Tnb.Systems/System/DataInterfaceService.cs index 9ca5c55b..15af8000 100644 --- a/system/Tnb.Systems/System/DataInterfaceService.cs +++ b/system/Tnb.Systems/System/DataInterfaceService.cs @@ -326,11 +326,11 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController } VerifyRequired(info, dicParameters); ReplaceParameterValue(info, dicParameters); - if (info.DataType == 1) + if (info?.DataType == 1) { output = await GetData(info); } - else if (info.DataType == 2) + else if (info?.DataType == 2) { output = info.Query.ToObject(); } @@ -338,7 +338,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController { output = await GetApiDataByTypePreview(info); } - if (info.DataProcessing.IsNullOrEmpty()) + if (info is null || info.DataProcessing.IsNullOrEmpty()) { return output; } @@ -897,8 +897,8 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController private async Task GetApiDataByTypePreview(DataInterfaceEntity entity) { var result = new JObject(); - var parameters = entity.RequestParameters.ToObject>(); - var parametersHerader = entity.RequestHeaders.ToObject>(); + var parameters = entity?.RequestParameters.ToObject>() ?? new List(); + var parametersHerader = entity?.RequestHeaders.ToObject>() ?? new List(); var dic = new Dictionary(); var dicHerader = new Dictionary(); dicHerader.Add("JNPF_API", true); @@ -914,7 +914,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController dicHerader[key.field] = key.defaultValue; } - switch (entity.RequestMethod) + switch (entity?.RequestMethod) { case "6": result = (await entity.Path.SetHeaders(dicHerader).SetQueries(dic).GetAsStringAsync()).ToObject();