Do not pass out-of-bounds data to mLists[index].setSelection

This might cause crashes and the cached data is *not* guaranteed to be 'recent'
This commit is contained in:
Adrian Ulrich 2016-02-05 11:03:45 +01:00
parent 0e9f5b590a
commit 3067e59223

View File

@ -650,9 +650,8 @@ public class LibraryPagerAdapter
int index = message.arg1;
mAdapters[index].commitQuery(message.obj);
Limiter curLimiter = mAdapters[index].getLimiter();
Integer curPos = sLruAdapterPos.getPosition(mAdapters[index]);
if (curPos != null)
if (curPos != null && curPos < mLists[index].getCount())
pos = (int)curPos;
mLists[index].setSelection(pos);