Skip to content

Commit

Permalink
Fix coordinate with null
Browse files Browse the repository at this point in the history
  • Loading branch information
gabber235 committed Nov 15, 2024
1 parent de9e0af commit 8932be3
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class CoordinateSerializer : DataSerializer<Coordinate> {
}

if (json is JsonObject) {
val x = json.get("x").asDouble
val y = json.get("y").asDouble
val z = json.get("z").asDouble
val yaw = json.get("yaw").asDouble
val pitch = json.get("pitch").asDouble
val x = json.get("x")?.asDouble ?: 0.0
val y = json.get("y")?.asDouble ?: 0.0
val z = json.get("z")?.asDouble ?: 0.0
val yaw = json.get("yaw")?.asDouble ?: 0.0
val pitch = json.get("pitch")?.asDouble ?: 0.0
return Coordinate(x, y, z, yaw.toFloat(), pitch.toFloat())
}

Expand Down

0 comments on commit 8932be3

Please sign in to comment.