iamutkarshtiwari / Ananas

An easy image editor integration for your Android apps.
MIT License
250 stars 112 forks source link

generatorBit() add Exception handling #109

Open Kim-DongGeun opened 1 year ago

Kim-DongGeun commented 1 year ago

hi i faced exception because getMeasuredWidth() return 0 so i add some code to handle this exception

this is crash log i faced

Fatal Exception: java.lang.IllegalArgumentException: width and height must be > 0
       at android.graphics.Bitmap.createBitmap(Bitmap.java:1102)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:1069)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:1019)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:980)
       at iamutkarshtiwari.github.io.ananas.editimage.view.CustomPaintView.generatorBit(CustomPaintView.java:60)
       at iamutkarshtiwari.github.io.ananas.editimage.view.CustomPaintView.reset(CustomPaintView.java:158)
       at iamutkarshtiwari.github.io.ananas.editimage.fragment.paint.PaintFragment.backToMain(PaintFragment.java:157)
       at iamutkarshtiwari.github.io.ananas.editimage.fragment.paint.PaintFragment.onClick(PaintFragment.java:116)
       at android.view.View.performClick(View.java:7792)
       at android.view.View.performClickInternal(View.java:7769)
       at android.view.View.access$3800(View.java:910)
       at android.view.View$PerformClick.run(View.java:30213)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8663)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)