yuyakaido / CardStackView

📱Tinder like swipeable card view for Android
Apache License 2.0
2.34k stars 443 forks source link

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

Open sagarbhojaviya opened 3 years ago

sagarbhojaviya commented 3 years ago

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

ItayFeld commented 2 years ago

@sagarbhojaviya Any leads on this issue?

sagarbhojaviya commented 2 years ago

No

Shvet commented 2 years ago

I am getting this error too.

ItayFeld commented 2 years ago

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

sagarbhojaviya commented 2 years ago

We removing card once swipe

Shvet commented 2 years ago

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

ItayFeld commented 2 years ago

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?

sagarbhojaviya commented 2 years ago

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

ItayFeld commented 2 years ago

Any card or just the last one?

sagarbhojaviya commented 2 years ago

it just a stand alone view

sagarbhojaviya commented 2 years ago

Any card or just the last one?

any card

Shvet commented 2 years ago

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)
ItayFeld commented 2 years ago

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

birukovjury commented 7 months ago

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