@@ -51,25 +51,32 @@ protected ServerResponse<List<VCMIMod>> doInBackground(final String... params)
51
51
final JSONArray names = jsonContent .names ();
52
52
for (int i = 0 ; i < names .length (); ++i )
53
53
{
54
- String name = names .getString (i );
55
- JSONObject modDownloadData = jsonContent .getJSONObject (name );
56
-
57
- if (modDownloadData .has ("mod" ))
54
+ try
58
55
{
59
- String modFileAddress = modDownloadData .getString ("mod" );
60
- ServerResponse < List < VCMIMod >> modFile = sendRequest ( modFileAddress );
56
+ String name = names .getString (i );
57
+ JSONObject modDownloadData = jsonContent . getJSONObject ( name );
61
58
62
- if (! modFile . isValid ( ))
59
+ if ( modDownloadData . has ( "mod" ))
63
60
{
64
- continue ;
65
- }
61
+ String modFileAddress = modDownloadData .getString ("mod" );
62
+ ServerResponse <List <VCMIMod >> modFile = sendRequest (modFileAddress );
63
+
64
+ if (!modFile .isValid ())
65
+ {
66
+ continue ;
67
+ }
66
68
67
- JSONObject modJson = new JSONObject (modFile .mRawContent );
68
- mods .add (VCMIMod .buildFromRepoJson (name , modJson , modDownloadData ));
69
+ JSONObject modJson = new JSONObject (modFile .mRawContent );
70
+ mods .add (VCMIMod .buildFromRepoJson (name , modJson , modDownloadData ));
71
+ }
72
+ else
73
+ {
74
+ mods .add (VCMIMod .buildFromRepoJson (name , modDownloadData , modDownloadData ));
75
+ }
69
76
}
70
- else
77
+ catch ( JSONException e )
71
78
{
72
- mods . add ( VCMIMod . buildFromRepoJson ( name , modDownloadData , modDownloadData ) );
79
+ Log . e ( this , "Could not parse the response as json" , e );
73
80
}
74
81
}
75
82
serverResponse .mContent = mods ;
0 commit comments