Open debabrata-rana opened 5 years ago
Observed by me also. @debabrata-rana How to fix this problem?
I fixed it by adding one line if(drawCanvas!=null)
So now the method looks like below
void clearAll() {
if(drawCanvas!=null)
drawCanvas.drawColor(0, PorterDuff.Mode.CLEAR);
invalidate();
}
Hi,
I've observed the following crash in the sample app. It crashes when the user clicks the "Clear All" button in the photo editor screen.
Steps to reproduce:
Exception log: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Canvas.drawColor(int, android.graphics.PorterDuff$Mode)' on a null object reference at com.ahmedadeltito.photoeditorsdk.BrushDrawingView.clearAll(BrushDrawingView.java:121) at com.ahmedadeltito.photoeditorsdk.PhotoEditorSDK.clearAllViews(PhotoEditorSDK.java:184) at com.ahmedadeltito.photoeditor.PhotoEditorActivity.clearAllViews(PhotoEditorActivity.java:216) at com.ahmedadeltito.photoeditor.PhotoEditorActivity.onClick(PhotoEditorActivity.java:340) at android.view.View.performClick(View.java:5198) at android.view.View$PerformClick.run(View.java:21147) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
It would be great if this issue is fixed quickly as I'm planning to integrate this lib.
Thanks & regards, Debu