mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-21 01:32:03 +03:00
feat(android): allow JSObject::getString
to return null
This commit is contained in:
parent
19cd0e4960
commit
e68a08da51
@ -13,14 +13,13 @@ class JSObject : JSONObject {
|
|||||||
constructor(obj: JSONObject, names: Array<String>) : super(obj, names)
|
constructor(obj: JSONObject, names: Array<String>) : super(obj, names)
|
||||||
|
|
||||||
override fun getString(key: String): String {
|
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 {
|
try {
|
||||||
val value = super.getString(key)
|
|
||||||
if (!super.isNull(key)) {
|
if (!super.isNull(key)) {
|
||||||
return value
|
return super.getString(key)
|
||||||
}
|
}
|
||||||
} catch (_: JSONException) {
|
} catch (_: JSONException) {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user