Skip to content

Commit

Permalink
feat(android): allow JSObject::getString to return null
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Apr 29, 2023
1 parent 19cd0e4 commit e68a08d
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -13,14 +13,13 @@ class JSObject : JSONObject {
constructor(obj: JSONObject, names: Array<String>) : super(obj, names)

override fun getString(key: String): String {
return getString(key, "")
return getString(key, "")!!
}

fun getString(key: String, defaultValue: String): String {
fun getString(key: String, defaultValue: String?): String? {
try {
val value = super.getString(key)
if (!super.isNull(key)) {
return value
return super.getString(key)
}
} catch (_: JSONException) {
}
Expand Down

0 comments on commit e68a08d

Please sign in to comment.