diff --git a/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt b/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt index 5dab4d4..6808ab7 100644 --- a/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt +++ b/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt @@ -24,7 +24,7 @@ data class Instance( * at least I think because it's recent and unavailable machines don't have that */ val startDate: Long, /** when instance will expire as unix seconds, like 1861891577 */ - val endDate: Long + val endDate: Long? ) { companion object { fun fromJson(json: JSONObject): Instance { @@ -36,7 +36,7 @@ data class Instance( json.getInt("num_gpus"), json.getDouble("dlperf"), json.getDouble("start_date").toLong(), - json.getDouble("end_date").toLong() + json.optLong("end_date").takeIf { it > 0 } ) } } diff --git a/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt b/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt index 9161de3..8392d45 100644 --- a/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt +++ b/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt @@ -65,7 +65,7 @@ data class Machine( json.getString("mobo_name"), json.getInt("cpu_ram"), json.getDouble("reliability2"), - HostingClass.entries.getOrElse(json.getInt("hostingType")) { HostingClass.PRIVATE }, + HostingClass.entries.getOrElse(json.optInt("hosting_type", 0)) { HostingClass.PRIVATE }, MachineVerification.fromString(json.getString("verification")) ) }