@@ -74,20 +74,19 @@ private fun jsonToSkins(jsonArray: JSONArray): List<Skin> {
74
74
private fun jsonToStatsDetails (json : JSONObject ): StatsDetails {
75
75
try {
76
76
return StatsDetails (
77
- speed = json.getInt(" speed" ),
78
- accuracy = json.getInt(" accuracy" ),
79
- antiAir = json.getInt(" antiair" ),
80
- antiSub = json.getInt(" antisubmarineWarfare" ),
81
- armor = json.getString(" armor" ),
82
- aviation = json.getInt(" aviation" ),
83
- evasion = json.getInt(" evasion" ),
84
- firepower = json.getInt(" firepower" ),
85
- health = json.getInt(" health" ),
86
- luck = json.getInt(" luck" ),
87
- // FIXME: it should be defined
77
+ speed = json.optInt(" speed" ),
78
+ accuracy = json.optInt(" accuracy" ),
79
+ antiAir = json.optInt(" antiair" ),
80
+ antiSub = json.optInt(" antisubmarineWarfare" ),
81
+ armor = json.optString(" armor" ),
82
+ aviation = json.optInt(" aviation" ),
83
+ evasion = json.optInt(" evasion" ),
84
+ firepower = json.optInt(" firepower" ),
85
+ health = json.optInt(" health" ),
86
+ luck = json.optInt(" luck" ),
88
87
oil = json.optInt(" oilConsumption" ),
89
- reload = json.getInt (" reload" ),
90
- torpedo = json.getInt (" torpedo" )
88
+ reload = json.optInt (" reload" ),
89
+ torpedo = json.optInt (" torpedo" )
91
90
)
92
91
} catch (e: JSONException ) {
93
92
throw e
0 commit comments