sergejsha / pinned-section-listview

Easy to use ListView with pinned sections for Android.
2.59k stars 808 forks source link

NullPointerException when using layoutparams without checking it in createPinnedShadow method #10

Closed Jween closed 11 years ago

Jween commented 11 years ago

NullPointerException occurs when using layoutparams without checking it in createPinnedShadow method, and I fixed it by adding the codes below: final ViewGroup.LayoutParams vlp = pinnedView.getLayoutParams(); AbsListView.LayoutParams lp; if (vlp == null) { lp = (LayoutParams) generateDefaultLayoutParams(); } else if (!checkLayoutParams(vlp)) { lp = (LayoutParams) generateLayoutParams(vlp); } else { lp = (LayoutParams) vlp; } pinnedView.setLayoutParams(lp); BETWEEN // request new view View pinnedView = getAdapter().getView(position, recycleView, PinnedSectionListView.this); AND // read layout parameters LayoutParams layoutParams = (LayoutParams) pinnedView.getLayoutParams();

sergejsha commented 11 years ago

This issue has been already fixed. Please pull the latest changes.