Browse Source

修复jarray空时报错的Bug.

sat23 3 years ago
parent
commit
76d6909b4e
1 changed files with 6 additions and 0 deletions
  1. 6 0
      FactoryTool_CShare/Business/CommonMethod.cs

+ 6 - 0
FactoryTool_CShare/Business/CommonMethod.cs

@@ -2673,6 +2673,12 @@ namespace MOKA_Factory_Tools
                         bool bResult = jObject["Result"].Value<bool>();
                         msg = jObject["Error"].Value<string>();
                         JArray jAry = (JArray)JsonConvert.DeserializeObject(jObject["Data"].ToString());
+                        if (jAry == null)
+                        {
+                            Log.WriteErrorLog("GetMIKey Json-null:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
+                            return false;
+                        }
+
                         if ( jAry.Count > 0 )
                         {
                             mikey = JsonConvert.DeserializeObject<MIKey>(jAry[0].ToString());