Skip to content

Commit

Permalink
Fix the crash using DiffUtil with FlexboxLayoutManager.
Browse files Browse the repository at this point in the history
Fixes #332
  • Loading branch information
thagikura committed May 14, 2018
1 parent c8ba335 commit d959b3d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2876,7 +2876,8 @@ private void assignFromView(View anchor) {
mPosition = getPosition(anchor);
mAssignedFromSavedState = false;
assert mFlexboxHelper.mIndexToFlexLine != null;
int flexLinePosition = mFlexboxHelper.mIndexToFlexLine[mPosition];
int flexLinePosition =
mFlexboxHelper.mIndexToFlexLine[mPosition != NO_POSITION ? mPosition : 0];
mFlexLinePosition = flexLinePosition != NO_POSITION ? flexLinePosition : 0;
// It's likely that the view is the first item in a flex line, but if not get the
// index of the first item in the same line because the calculation of the flex lines
Expand Down

0 comments on commit d959b3d

Please # to comment.