Skip to content

Commit

Permalink
Fixed NPE in ByteArrayParcel due to initialization of data property -…
Browse files Browse the repository at this point in the history
… GHI #2
  • Loading branch information
chRyNaN committed Sep 9, 2022
1 parent 9a02030 commit 836c8e2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import kotlin.experimental.and
*/
class ByteArrayParcel internal constructor(initial: ByteArray = byteArrayOf()) : Parcel {

init {
setDataFromByteArray(value = initial)
}

override val dataBufferCapacity: Int
get() = data.size

Expand All @@ -31,6 +27,10 @@ class ByteArrayParcel internal constructor(initial: ByteArray = byteArrayOf()) :

private val data = mutableListOf<ByteArray>()

init {
setDataFromByteArray(value = initial)
}

override fun readBoolean(): Boolean {
val result = data[dataPosition][0].toBooleanValue()

Expand Down

0 comments on commit 836c8e2

Please sign in to comment.