minor
This commit is contained in:
parent
00e030b475
commit
fe69c0eba5
1 changed files with 6 additions and 1 deletions
|
@ -205,7 +205,12 @@ class ImageByteStreamHandler(private val context: Context, private val arguments
|
||||||
var len: Int
|
var len: Int
|
||||||
while (inputStream.read(buffer).also { len = it } != -1) {
|
while (inputStream.read(buffer).also { len = it } != -1) {
|
||||||
// cannot decode image on Flutter side when using `buffer` directly
|
// cannot decode image on Flutter side when using `buffer` directly
|
||||||
success(buffer.copyOf(len))
|
if (MemoryUtils.canAllocate(len)) {
|
||||||
|
success(buffer.copyOf(len))
|
||||||
|
} else {
|
||||||
|
error("streamBytes-memory", "not enough memory to allocate $len bytes", null)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue