baronha / react-native-photo-editor

🌄 Photo editor using native modules for iOS and Android. Inherit from 2 available libraries, ZLImageEditor (iOS) and PhotoEditor (Android)
MIT License
440 stars 138 forks source link

Editor Crashing When Sticker is Larger Than Image or Placed Outside Image #74

Open YashM20 opened 3 months ago

YashM20 commented 3 months ago

Issue: Editor Crashing When Sticker is Larger Than Image or Placed Outside Image

Description: The photo editor crashes when a sticker is either larger than the image itself or placed outside the image boundaries. This issue disrupts the editing experience and requires a restart of the app to recover.

Environment:

Steps to Reproduce:

  1. Open the photo editor.
  2. Add an landscape image to edit.
  3. Select a sticker and place it on the image.
  4. Resize the sticker to be larger than the image or move the sticker outside the image boundaries.
  5. Observe the crash.

Expected Behavior: The photo editor should handle stickers gracefully, even if they are larger than the image or placed outside the image boundaries. It should not crash, sticker should get cropped accordingky

Actual Behavior: The photo editor crashes when a sticker is resized to be larger than the image or placed outside the image boundaries.

Screenshots/Video:

https://github.com/baronha/react-native-photo-editor/assets/67644300/4b5b63d6-003c-46e2-b628-60b8f3ac2d73

Logs: native exception java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:415) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381) at java.util.concurrent.FutureTask.setException(FutureTask.java:250) at java.util.concurrent.FutureTask.run(FutureTask.java:269) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) Caused by: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 0 at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) at java.util.Objects.checkIndex(Objects.java:359) at java.util.ArrayList.get(ArrayList.java:434) at android.view.ViewGroup.getAndVerifyPreorderedView(ViewGroup.java:3811) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4342) at android.view.View.draw(View.java:23699) at android.view.ViewGroup.drawChild(ViewGroup.java:4586) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4344) at android.view.View.draw(View.java:23850) at ja.burhanrashid52.photoeditor.PhotoSaverTask.captureView(PhotoSaverTask.java:161) at ja.burhanrashid52.photoeditor.PhotoSaverTask.buildBitmap(PhotoSaverTask.java:104) at ja.burhanrashid52.photoeditor.PhotoSaverTask.saveImageInFile(PhotoSaverTask.java:88) at ja.burhanrashid52.photoeditor.PhotoSaverTask.doInBackground(PhotoSaverTask.java:70) at ja.burhanrashid52.photoeditor.PhotoSaverTask.doInBackground(PhotoSaverTask.java:23) at android.os.AsyncTask$3.call(AsyncTask.java:394) at java.util.concurrent.FutureTask.run(FutureTask.java:264)

Neelshah768 commented 3 months ago

I am also facing same issue.

baronha commented 3 months ago

I will look into it ASAP. Thank you for trusting this library.

Pinky-Billava commented 2 months ago

I'm experiencing the same problem as well

Pinky-Billava commented 2 months ago

@baronha Any update on this one?