Unverified Commit ca937553 authored by LaoLittle's avatar LaoLittle Committed by GitHub

`Image.makeFromEncoded()` makes jvm crash (#534)

* jvm crash when input array is null

* makes `bytes` non-null
parent d74bfcea
...@@ -131,10 +131,10 @@ class Image internal constructor(ptr: NativePointer) : RefCnt(ptr), IHasImageInf ...@@ -131,10 +131,10 @@ class Image internal constructor(ptr: NativePointer) : RefCnt(ptr), IHasImageInf
} }
} }
fun makeFromEncoded(bytes: ByteArray?): Image { fun makeFromEncoded(bytes: ByteArray): Image {
Stats.onNativeCall() Stats.onNativeCall()
val ptr = interopScope { val ptr = interopScope {
_nMakeFromEncoded(toInterop(bytes), bytes?.size ?: 0) _nMakeFromEncoded(toInterop(bytes), bytes.size)
} }
require(ptr != NullPointer) { "Failed to Image::makeFromEncoded" } require(ptr != NullPointer) { "Failed to Image::makeFromEncoded" }
return Image(ptr) return Image(ptr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment