Explorar o código

修复jarray空时报错的Bug.

sat23 %!s(int64=3) %!d(string=hai) anos
pai
achega
76d6909b4e
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  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());