OpenSooq / Pluto

Pluto is an Easy, lightweight and high performance slider view library for Android. You have the flexibility to customize it to any view since it based RecyclerView.
https://engineering.opensooq.com
109 stars 16 forks source link

App crash Fatal Exception: kotlin.KotlinNullPointerException at getShouldDrawCount (PlutoIndicator.kt:91) #11

Closed amjadmasri closed 4 years ago

amjadmasri commented 5 years ago

new version of our app has launched yesterday using your library and a lot of crashes happened really fast here is the crash

Fatal Exception: kotlin.KotlinNullPointerException
       at com.opensooq.pluto.PlutoIndicator.getShouldDrawCount + 91(PlutoIndicator.kt:91)
       at com.opensooq.pluto.PlutoIndicator.redraw + 403(PlutoIndicator.kt:403)
       at com.opensooq.pluto.PlutoIndicator$initObserver$1.onChanged + 174(PlutoIndicator.kt:174)
       at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyChanged + 11997(RecyclerView.java:11997)
       at androidx.recyclerview.widget.RecyclerView$Adapter.notifyDataSetChanged + 7070(RecyclerView.java:7070)
       at com.opensooq.pluto.base.PlutoAdapter.clear + 47(PlutoAdapter.kt:47)

we have set app:indicator_visibility="false" //this line didn't make the indicators disappear on its own so also onCreate we have set plutoView.setIndicatorVisibility(false);

any help would be appreciated thanks

amjadmasri commented 5 years ago

@Ramzi-Alqrainy @tamtom turns out that this is happening because of configuration changes and the activity being recreated what do you suggest for handling this ? I thought that recreating the activity would create a new instance but apparently the old instance remains with null recyclerView ? can you help me please ?

tamtom commented 4 years ago

@amjadmasri fixed in 1.6