Closed loganSims closed 8 years ago
I think the problem is with toLocation
. When there is no destination selected, toLocation
is set to fromLocation
in DepartingTrainsLoader()
. toLocation
is then used in onBindViewHolder()
in the recycler adapter. On a configuration change (screen rotation) toLocation
gets set back to "N/A" in onAttach()
, is never changed to fromLocation
in DepartingTrainsLoader()
and is used by OnBindViewHolder()
which causes problems.
Trace from commit 680abd2df29068e904696ca00b0bc5c3fba83f5c
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String
gov.wa.wsdot.android.wsdot.shared.AmtrakCascadesScheduleItem.getScheduledDepartureTime()'
on a null object reference
at gov.wa.wsdot.android.wsdot.ui.amtrakcascades.AmtrakCascadesSchedulesDetailsFragment$
ScheduleAdapter.onBindViewHolder(AmtrakCascadesSchedulesDetailsFragment.java:725)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:5217)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:5250)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4487)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
...
Rotating the device from portrait to landscape while viewing a schedule with no destination selected causes the view to crash. If you have a destination selected it works as expected when rotating the device.
Trace from Version 3.5.2