diff --git a/src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs b/src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs index 83a8c6231..c075bbd1f 100644 --- a/src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs +++ b/src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs @@ -264,6 +264,11 @@ private async Task CheckResponseSignAsync(WeChatPayHeaders headers, string body, /// private static void EncryptPrivacyProperty(WeChatPayObject obj, RSA rsa) { + if(obj == null) + { + return; + } + foreach (var propertyInfo in obj.GetType().GetProperties()) { if (propertyInfo.PropertyType == typeof(string)) // 加密字符串 @@ -326,6 +331,11 @@ private static void EncryptPrivacyProperty(WeChatPayObject obj, RSA rsa) /// private static void DecryptPrivacyProperty(WeChatPayObject obj, RSA rsa) { + if(obj == null) + { + return; + } + foreach (var propertyInfo in obj.GetType().GetProperties()) { if (propertyInfo.PropertyType == typeof(string)) // 加密字符串