Skip to content

Commit f0b09a0

Browse files
authored
Merge branch 'master' into 5037-sync-improvement-1
2 parents 83d7620 + 971385e commit f0b09a0

File tree

1 file changed

+2
-2
lines changed
  • app/src/main/java/org/ole/planet/myplanet/utilities

1 file changed

+2
-2
lines changed

app/src/main/java/org/ole/planet/myplanet/utilities/JsonUtils.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ object JsonUtils {
9292
return try {
9393
if (jsonObject?.has(fieldName) == true) {
9494
val el: JsonElement = jsonObject.get(fieldName)
95-
if (el is JsonNull) 0 else el.asInt
95+
if (el is JsonNull || el.asString.isEmpty()) 0 else el.asInt
9696
} else {
9797
0
9898
}
@@ -107,7 +107,7 @@ object JsonUtils {
107107
return try {
108108
if (jsonObject?.has(fieldName) == true) {
109109
val el: JsonElement = jsonObject.get(fieldName)
110-
if (el is JsonNull) 0f else el.asFloat
110+
if (el is JsonNull || el.asString.isEmpty()) 0f else el.asFloat
111111
} else {
112112
getInt(fieldName, jsonObject).toFloat()
113113
}

0 commit comments

Comments
 (0)