Malinskiy / SuperRecyclerView

Pumped up RecyclerView
2.63k stars 469 forks source link

Fixed a crash when the adapter still triggers the update of the previous recycler view #103

Open KelvinJin opened 8 years ago

KelvinJin commented 8 years ago

How to reproduce the bug:

The recyclerView will get notified since the observer is not cancelled. But now, recyclerView.getAdapter() will return null, this will crash when recyclerView.getAdapter().getCount() is called.

This PR fixed this issue by cancelling the observation once the adapter is changed. (Essentially this is how the official RecyclerView handles adapter changing.)