Crash with Gridlayout

Open
#63 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
android, kotlin
Domain
mobile-dev

Research direction

Start with the stack trace at GridLayoutManager.java:1704, then trace the call path through SingleRow.java, Grid.java, and the Leanback fragment rendering flow. Reproduce the random crash while rendering or scrolling and establish a reliable trigger; done means the trigger no longer produces the null-state crash and the relevant behavior is covered by a regression check.

Written by the indexing model from the issue text.

Description

Hi All,

I am getting below crash randomly when we render the leanback fragment

 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView$State.isPreLayout()' on a null object reference
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.leanback.widget.GridLayoutManager$2.addItem(GridLayoutManager.java:1704)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.leanback.widget.SingleRow.prependVisibleItems(SingleRow.java:93)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.leanback.widget.Grid.prependVisibleItems(Grid.java:371)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.leanback.widget.GridLayoutManager.prependVisibleItems(GridLayoutManager.java:1940)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.leanback.widget.GridLayoutManager.scrollDirectionPrimary(GridLayoutManager.java:2455)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.leanback.widget.GridLayoutManager.scrollVerticallyBy(GridLayoutManager.java:2406)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1972)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5476)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:781)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.view.Choreographer.doCallbacks(Choreographer.java:592)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.view.Choreographer.doFrame(Choreographer.java:559)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:767)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.os.Handler.handleCallback(Handler.java:739)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.os.Looper.loop(Looper.java:135)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at android.app.ActivityThread.main(ActivityThread.java:5604)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at java.lang.reflect.Method.invoke(Native Method)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at java.lang.reflect.Method.invoke(Method.java:372)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
08-11 18:11:23.668 E/AndroidRuntime(16942): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

How to fix this

Dominant language
Kotlin
Stars
1.3k
Forks
400
Avg merge
9d 10h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/tv-samples

All issues in android/tv-samples

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.