Skip to content

Commit

Permalink
fix(android): improve selection validation (#12682)
Browse files Browse the repository at this point in the history
Fixes TIMOB-28410
  • Loading branch information
garymathews committed Apr 6, 2021
1 parent 92603cd commit 42ac86b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom, int
@Override
public Object getKey(int position)
{
return items.get(position);
if (position > -1 && position < items.size()) {
return items.get(position);
}
return null;
}

@Override
Expand Down Expand Up @@ -186,7 +189,12 @@ public int getPosition()
@Override
public Object getSelectionKey()
{
return items.get(getPosition());
final int position = getPosition();

if (position > -1 && position < items.size()) {
return items.get(position);
}
return null;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom, int
@Override
public Object getKey(int position)
{
return rows.get(position);
if (position > -1 && position < rows.size()) {
return rows.get(position);
}
return null;
}

@Override
Expand Down Expand Up @@ -192,7 +195,12 @@ public int getPosition()
@Override
public Object getSelectionKey()
{
return rows.get(getPosition());
final int position = getPosition();

if (position > -1 && position < rows.size()) {
return rows.get(position);
}
return null;
}
};
}
Expand Down

0 comments on commit 42ac86b

Please sign in to comment.