Skip to content
Snippets Groups Projects
Commit 02eefd3c authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Updated decoding to recognize "null" Strings

parent f28f8330
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ interface BindingsModel {
inline fun <reified T> decode(data: ByteArray?): T? {
return data?.run {
if (isNotEmpty()) {
if (isNotEmpty() && decodeToString() != "null") {
val typeToken = object : TypeToken<T>() {}.type
Gson().fromJson<T>(decodeToString(), typeToken)
} else {
......@@ -31,7 +31,7 @@ interface BindingsModel {
inline fun <reified T> decodeArray(data: ByteArray?): List<T> {
return data?.run {
if (isNotEmpty()) {
if (isNotEmpty() && decodeToString() != "null") {
val typeToken = object : TypeToken<Array<T>>() {}.type
Gson().fromJson<Array<T>>(decodeToString(), typeToken).toList()
} else listOf()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment