Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash: ImageUtil.getImageMatrixFromFilePath #34

Open
RomanTsarou opened this issue Aug 7, 2023 · 2 comments · May be fixed by #47
Open

Crash: ImageUtil.getImageMatrixFromFilePath #34

RomanTsarou opened this issue Aug 7, 2023 · 2 comments · May be fixed by #47

Comments

@RomanTsarou
Copy link

image

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.websitebeaver.documentscanner.utils.ImageUtil.getImageMatrixFromFilePath(ImageUtil.java:68) at com.websitebeaver.documentscanner.utils.ImageUtil.getImageFromFilePath(ImageUtil.java:86) at com.websitebeaver.documentscanner.DocumentScannerActivity$cameraUtil$1.invoke(DocumentScannerActivity.java:88) at com.websitebeaver.documentscanner.DocumentScannerActivity$cameraUtil$1.invoke(DocumentScannerActivity.java:75) at com.websitebeaver.documentscanner.utils.CameraUtil.startForResult$lambda-0(CameraUtil.java:41) at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:418) at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:375) at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:819) at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:164) at android.app.Activity.dispatchActivityResult(Activity.java:8192) at android.app.ActivityThread.deliverResults(ActivityThread.java:4965) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4292) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4338) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2057) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7649) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

I guess it can fix the problem: https://stackoverflow.com/questions/8442316/bitmap-is-returning-null-from-bitmapfactory-decodefilefilename.

@dmarcs
Copy link
Contributor

dmarcs commented Dec 17, 2023

I wonder if this happens because the photo file size is too big. Can you try to decrease DocumentScannerExtra.EXTRA_CROPPED_IMAGE_QUALITY, and see if this still happens?

@paultranvan
Copy link

Hi, I reproduce this issue.
I ugpraded to the 1.3.5 version after having this issue: #29
This one is solved, but only to fall on this new one 😄 It might be related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants