Skip to content

Commit

Permalink
handle null properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Sep 26, 2020
1 parent 5b37444 commit b9f03d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'kweb'
version '0.4.6'
version '0.4.7'

buildscript {
ext.kotlin_version = '1.4.10'
Expand Down
8 changes: 5 additions & 3 deletions src/main/kotlin/kweb/shoebox/stores/MapDBStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import org.mapdb.Serializer
@ExperimentalSerializationApi
class MapDBStore<T : Any>(val db : DB, val name : String, val serializer: KSerializer<T>) : Store<T> {

private val protoBuf = ProtoBuf { encodeDefaults = false }

private val map =
db
.hashMap(name)
Expand All @@ -31,7 +33,7 @@ class MapDBStore<T : Any>(val db : DB, val name : String, val serializer: KSeria
return if (v == null) {
null
} else {
ProtoBuf.decodeFromByteArray(serializer, v)
protoBuf.decodeFromByteArray(serializer, v)
}
}

Expand All @@ -40,7 +42,7 @@ class MapDBStore<T : Any>(val db : DB, val name : String, val serializer: KSeria
return if (v == null) {
null
} else {
ProtoBuf.decodeFromByteArray(serializer, v)
protoBuf.decodeFromByteArray(serializer, v)
}
}

Expand All @@ -50,7 +52,7 @@ class MapDBStore<T : Any>(val db : DB, val name : String, val serializer: KSeria
return if (v == null) {
null
} else {
ProtoBuf.decodeFromByteArray(serializer, v)
protoBuf.decodeFromByteArray(serializer, v)
}
}
}

0 comments on commit b9f03d2

Please sign in to comment.