Roc vor 1 Jahr
Ursprung
Commit
2ca5ce0c95
1 geänderte Dateien mit 10 neuen und 0 gelöschten Zeilen
  1. 10 0
      src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs

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

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