Dhaval2404 / ImagePicker

📸Image Picker for Android, Pick an image from Gallery or Capture a new image with Camera
Apache License 2.0
1.54k stars 341 forks source link

Crash - width and height must be > 0 #332

Open jmprivate47 opened 1 year ago

jmprivate47 commented 1 year ago

Summary

Receive crash after trying to get photo from device

Android version

Reproduced on Android 10, 11, 12, 13

Impacted devices

Samsung : Galaxy A03, Galaxy A6+, Galaxy A13. Transsion Tecno Spark 8C Vivo 1907 Transsion - Mediatek: Infinix Note 10, Infinix HOT 12 Play.

Installation method

Library installed using Gradle dependency - implementation 'com.github.dhaval2404:imagepicker:2.1'

SDK version

2.1

Other information

Caused by java.lang.IllegalArgumentException: width and height must be > 0 at android.graphics.Bitmap.createBitmap(Bitmap.java:1113) at android.graphics.Bitmap.createBitmap(Bitmap.java:1080) at android.graphics.Bitmap.createBitmap(Bitmap.java:1030) at android.graphics.Bitmap.createBitmap(Bitmap.java:991) at com.github.dhaval2404.imagepicker.util.ImageUtil.decodeSampledBitmapFromFile(ImageUtil.java:124) at com.github.dhaval2404.imagepicker.util.ImageUtil.compressImage(ImageUtil.java:54) at com.github.dhaval2404.imagepicker.provider.CompressionProvider.applyCompression(CompressionProvider.kt:200) at com.github.dhaval2404.imagepicker.provider.CompressionProvider.startCompression(CompressionProvider.kt:140) at com.github.dhaval2404.imagepicker.provider.CompressionProvider.access$startCompression(CompressionProvider.java:22) at com.github.dhaval2404.imagepicker.provider.CompressionProvider$startCompressionWorker$1.doInBackground(CompressionProvider.kt:113) at com.github.dhaval2404.imagepicker.provider.CompressionProvider$startCompressionWorker$1.doInBackground(CompressionProvider.kt:109) at android.os.AsyncTask$3.call(AsyncTask.java:378) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)