Kaynağa Gözat

修复可能的报错

zengjiebin 7 yıl önce
ebeveyn
işleme
15718b3a11

+ 17 - 3
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGcGameAppDetail.java

@@ -21,6 +21,7 @@ import com.sheep.gamegroup.model.entity.ShowAll;
 import com.sheep.gamegroup.model.entity.UserComment;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.TextViewUtil;
 import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
@@ -29,6 +30,7 @@ import com.sheep.gamegroup.view.adapter.AdpGcGameAppInfoList;
 import com.sheep.gamegroup.view.adapter.AdpGcGameAppList;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.G;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -130,12 +132,24 @@ public class FgtGcGameAppDetail extends BaseRefreshLoadMoreFragment implements A
         entryList.add(new Entry<>("更新日期", TimeUtil.TimeStamp2Date(gameApp.getDownload_at(), "yyyy-MM-dd")));
         entryList.add(new Entry<>("发行商", gameApp.getManufacturer()));
 
-        JSONObject jsonObject = JSONObject.parseObject(gameApp.getExt_detail());
-        for (Map.Entry<String, Object> item : jsonObject.entrySet()) {
+        if(gameApp.getExt_detail() != null) {
             try {
-                entryList.add(new Entry<>(item.getKey(), item.getValue().toString()));
+                JSONObject jsonObject = JSONObject.parseObject(gameApp.getExt_detail());
+                if (jsonObject != null) {
+                    for (Map.Entry<String, Object> item : jsonObject.entrySet()) {
+                        try {
+                            entryList.add(new Entry<>(item.getKey(), item.getValue().toString()));
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            if(TestUtil.isDev())
+                                G.showToast(e.getMessage());
+                        }
+                    }
+                }
             } catch (Exception e) {
                 e.printStackTrace();
+                if(TestUtil.isDev())
+                    G.showToast(e.getMessage());
             }
         }
         gameInfoListArrayList.add(new GameInfoList("详细信息", new RecyclerViewAdapter<Entry<String, String>>(SheepApp.getInstance(), R.layout.item_gc_game_info, entryList) {