Roc 1 gadu atpakaļ
vecāks
revīzija
2ca5ce0c95

+ 10 - 0
src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs

@@ -264,6 +264,11 @@ namespace Essensoft.Paylink.WeChatPay.V3
         /// </remarks>
         /// </remarks>
         private static void EncryptPrivacyProperty(WeChatPayObject obj, RSA rsa)
         private static void EncryptPrivacyProperty(WeChatPayObject obj, RSA rsa)
         {
         {
+            if(obj == null)
+            {
+                return;
+            }
+
             foreach (var propertyInfo in obj.GetType().GetProperties())
             foreach (var propertyInfo in obj.GetType().GetProperties())
             {
             {
                 if (propertyInfo.PropertyType == typeof(string)) // 加密字符串
                 if (propertyInfo.PropertyType == typeof(string)) // 加密字符串
@@ -326,6 +331,11 @@ namespace Essensoft.Paylink.WeChatPay.V3
         /// </remarks>
         /// </remarks>
         private static void DecryptPrivacyProperty(WeChatPayObject obj, RSA rsa)
         private static void DecryptPrivacyProperty(WeChatPayObject obj, RSA rsa)
         {
         {
+            if(obj == null)
+            {
+                return;
+            }
+
             foreach (var propertyInfo in obj.GetType().GetProperties())
             foreach (var propertyInfo in obj.GetType().GetProperties())
             {
             {
                 if (propertyInfo.PropertyType == typeof(string)) // 加密字符串
                 if (propertyInfo.PropertyType == typeof(string)) // 加密字符串