natario1 / CameraView

📸 A well documented, high-level Android interface that makes capturing pictures and videos easy, addressing all of the common issues and needs. Real-time filters, gestures, watermarks, frame processing, RAW, output of any size.
https://natario1.github.io/CameraView
Other
4.89k stars 922 forks source link

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getHeight()' on a null object reference #1279

Open khiemdnt opened 1 week ago

khiemdnt commented 1 week ago

Describe the bug

Please add a clear description of what the bug is, and fill the list below.

Hello, thank you for helpful this repository.

I implement cameraview in fragment and then I found crash in firebase crashlytics. So, I want how to fix it. thank you

Bug:

      Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getHeight()' on a null object reference
   at android.widget.TextView.getVerticalOffset(TextView.java:7722)
   at android.widget.TextView.onDraw(TextView.java:8358)
   at android.view.View.draw(View.java:23626)
   at android.view.View.updateDisplayListIfDirty(View.java:22422)
   at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4627)
   at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4600)
   at android.view.View.updateDisplayListIfDirty(View.java:22352)
   at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4627)
   at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4600)
   at android.view.View.updateDisplayListIfDirty(View.java:22352)
   at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4627)
   at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4600)
   at android.view.View.updateDisplayListIfDirty(View.java:22352)
   at android.view.View.draw(View.java:23325)
   at android.view.ViewGroup.drawChild(ViewGroup.java:4643)
   at com.otaliastudios.cameraview.overlay.OverlayLayout.doDrawChild(OverlayLayout.java:180)
   at com.otaliastudios.cameraview.overlay.OverlayLayout.drawChild(OverlayLayout.java:169)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4401)
   at com.otaliastudios.cameraview.overlay.OverlayLayout.drawOn(OverlayLayout.java:151)
   at com.otaliastudios.cameraview.overlay.OverlayDrawer.draw(OverlayDrawer.java:74)
   at com.otaliastudios.cameraview.video.encoding.TextureMediaEncoder.onFrame(TextureMediaEncoder.java:218)
   at com.otaliastudios.cameraview.video.encoding.TextureMediaEncoder.onEvent(TextureMediaEncoder.java:146)
   at com.otaliastudios.cameraview.video.encoding.MediaEncoder$3.run(MediaEncoder.java:244)
   at android.os.Handler.handleCallback(Handler.java:942)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loopOnce(Looper.java:211)
   at android.os.Looper.loop(Looper.java:300)
   at android.os.HandlerThread.run(HandlerThread.java:67)