jayrambhia / CropperNoCropper

Instagram Style Image Cropper for Android (Library)
http://www.jayrambhia.com/project/nocropper-library
Apache License 2.0
475 stars 99 forks source link

Application crashes after drag the image out of the screen #23

Closed rednels closed 6 years ago

rednels commented 7 years ago

I did the following steps:

  1. first, select a 9:16(w:h) image,
  2. click make it fit to screen,
  3. then, scale it a little use two fingers
  4. drag it up out of the screen
  5. crop the image

after that, it crashes.

update:

it will crash after i scale it smaller but not to fit center. steps:

  1. select a pic
  2. scale it a little smaller 3.crop then, it crashes.
jayrambhia commented 7 years ago

@rednels Can you give me the stacktrace so I can debug what the problem is? I am not able to reproduce it. Also, when you drag the image out of the screen, until the image is re-adjusted to the screen, the cropper won't crop the image. cropBitmap() will return null. Maybe that's why it's crashing.

jayrambhia commented 7 years ago

Closing the issue as invalid.

rednels commented 7 years ago

Sorry for late.

errer log:

 Process: com.fenctose.imagecropper, PID: 31352
Theme: themes:{}
java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:309)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
 Caused by: java.lang.IllegalArgumentException: x must be >= 0
    at android.graphics.Bitmap.checkXYSign(Bitmap.java:364)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:684)
    at com.fenchtose.nocropper.CropperImageView.getCroppedBitmap(CropperImageView.java:812)
    at com.fenchtose.nocropper.CropperImageView.cropBitmap(CropperImageView.java:679)
    at com.fenchtose.nocropper.CropperTask.doInBackground(CropperTask.java:24)
    at com.fenchtose.nocropper.CropperTask.doInBackground(CropperTask.java:6)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
    at java.lang.Thread.run(Thread.java:818) 

error screen record : here

jayrambhia commented 7 years ago

Thanks for the crash log. I'll look into it.

jayrambhia commented 6 years ago

Fixed in 0.2.1