expandable-recycler-view
expandable-recycler-view copied to clipboard
There is a crash when parent object return null in getchildList()
If one of the parent has no children, The application crashes. I am working on 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference at com.bignerdranch.expandablerecyclerview.model.ExpandableWrapper.generateChildItemList(ExpandableWrapper.java:99) at com.bignerdranch.expandablerecyclerview.model.ExpandableWrapper.
(ExpandableWrapper.java:33) at com.bignerdranch.expandablerecyclerview.ExpandableRecyclerAdapter.generateParentWrapper(ExpandableRecyclerAdapter.java:1357) at com.bignerdranch.expandablerecyclerview.ExpandableRecyclerAdapter.generateFlattenedParentChildList(ExpandableRecyclerAdapter.java:1326) at com.bignerdranch.expandablerecyclerview.ExpandableRecyclerAdapter. (ExpandableRecyclerAdapter.java:120)
If the parent has no child, I think you'd better to return Collections.EMPTY_LIST.
Thanks for the report. I'll take a look at what it might take to protect from a null child list. Right now @hyb1996 is correct that we expect an empty list. At least I'm going to have the method annotated with @NotNull if that's what it expects.