Skip to content

Commit aa578fc

Browse files
committed
catch asBoolean
Signed-off-by: alperozturk <alper_ozturk@proton.me>
1 parent 8918f9b commit aa578fc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

library/src/main/java/com/nextcloud/extensions/JsonObjectExtensions.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ fun JsonObject?.getBoolean(key: String): Boolean? {
1717
}
1818

1919
if (has(key) && get(key).isJsonPrimitive) {
20-
return get(key).asBoolean
20+
return try {
21+
get(key).asBoolean
22+
} catch (_: UnsupportedOperationException) {
23+
null
24+
}
2125
}
2226

2327
return null

0 commit comments

Comments
 (0)