-
Notifications
You must be signed in to change notification settings - Fork 44
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
App crash when data count is less than columns count in GridDividerItemDecoration #28
Comments
Hey @adammo1990, I'm currently working on a 2.0 version of the library and the sample that will take care of this issue. Thanks for the heads up! |
This can be used as a temporary fix if needed
|
I try to decode the math in this calculation. Finally, I found I solve the problem. Here, I add some check in You can find the gist file in :https://gist.github.com/ysmintor/b974a7e0ab155cc9d9d8818182626e05 |
App crash when data count is less than columns count (if I'm using GridDividerItemDecoration)
Below log:
08-22 06:45:15.364 5852-5852/pl.myapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: pl.myapp, PID: 5852
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference
at com.dgreenhalgh.android.simpleitemdecoration.grid.GridDividerItemDecoration.drawHorizontalDividers(GridDividerItemDecoration.java:84)
at com.dgreenhalgh.android.simpleitemdecoration.grid.GridDividerItemDecoration.onDraw(GridDividerItemDecoration.java:43)
at android.support.v7.widget.RecyclerView.onDraw(RecyclerView.java:3658)
at android.view.View.draw(View.java:15231)
at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:3593)
at android.view.View.updateDisplayListIfDirty(View.java:14167)
at android.view.View.getDisplayList(View.java:14189)
at android.view.View.draw(View.java:14959)
at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14162)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:318)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2530)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2352)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1982)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.h
The text was updated successfully, but these errors were encountered: