CardStackView icon indicating copy to clipboard operation
CardStackView copied to clipboard

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView$ViewHolder.isTmpDetached()' on a null object reference

Open sagarbhojaviya opened this issue 5 years ago • 14 comments

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView$ViewHolder.isTmpDetached()' on a null object reference at androidx.recyclerview.widget.RecyclerView$Recycler.recycleView(RecyclerView.java:6361) at androidx.recyclerview.widget.RecyclerView$LayoutManager.removeAndRecycleView(RecyclerView.java:8901) at com.yuyakaido.android.cardstackview.CardStackLayoutManager.update(CardStackLayoutManager.java:268) at com.yuyakaido.android.cardstackview.CardStackLayoutManager.scrollHorizontallyBy(CardStackLayoutManager.java:107) at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1838) at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5302) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010) at android.view.Choreographer.doCallbacks(Choreographer.java:809) at android.view.Choreographer.doFrame(Choreographer.java:740) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8456) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

This is coming if I scroll fast

sagarbhojaviya avatar Apr 01 '21 11:04 sagarbhojaviya

@sagarbhojaviya Any leads on this issue?

ItayFeld avatar Feb 16 '22 11:02 ItayFeld

No

sagarbhojaviya avatar Feb 16 '22 11:02 sagarbhojaviya

I am getting this error too.

Shvet avatar Feb 16 '22 12:02 Shvet

Are you guys holding the StackView as an item inside a RecyclerView and removing it once the cards are all swiped?

ItayFeld avatar Feb 16 '22 12:02 ItayFeld

We removing card once swipe

sagarbhojaviya avatar Feb 16 '22 12:02 sagarbhojaviya

I think it is already coded in CardStackLayoutManager for removing it.

Shvet avatar Feb 16 '22 12:02 Shvet

Yap, every card that is swiped is being removed but once all cards are swiped, do you delete the StackView from an adapter or something or is it just a stand alone view?

ItayFeld avatar Feb 16 '22 12:02 ItayFeld

If you are swiping card very fast than chances to crash by this error

sagarbhojaviya avatar Feb 16 '22 12:02 sagarbhojaviya

Any card or just the last one?

ItayFeld avatar Feb 16 '22 12:02 ItayFeld

it just a stand alone view

sagarbhojaviya avatar Feb 16 '22 12:02 sagarbhojaviya

Any card or just the last one?

any card

sagarbhojaviya avatar Feb 16 '22 12:02 sagarbhojaviya

I dont know, I m getting it on Crashlytics so to know how exception occurred, i may need to test multiple times.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView$a0.isTmpDetached()' on a null object reference
       at androidx.recyclerview.widget.RecyclerView$Recycler.recycleView(RecyclerView.java:6542)
       at androidx.recyclerview.widget.RecyclerView$LayoutManager.removeAndRecycleView(RecyclerView.java:9200)
       at com.shvet.dreamromance.modules.cardstackview.CardStackLayoutManager.update(CardStackLayoutManager.java:257)
       at com.shvet.dreamromance.modules.cardstackview.CardStackLayoutManager.scrollHorizontallyBy(CardStackLayoutManager.java:97)
       at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1969)
       at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5476)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
       at android.view.Choreographer.doCallbacks(Choreographer.java:809)
       at android.view.Choreographer.doFrame(Choreographer.java:740)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8633)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Shvet avatar Feb 16 '22 12:02 Shvet

Yap, it's the same crash I'm seeing in the Crashlytics but can't manage to reproduce it myself for testing solutions.

ItayFeld avatar Feb 16 '22 12:02 ItayFeld

Hi there! Still have this issue. It causes complaints from users...Does anybody have any solution?

birukovjury avatar Dec 20 '23 04:12 birukovjury